I am very new at angular and I tried to learn angular 5 from basic. I just tried the ngIf directive and I found that if part has not got any problem but when I use else part as in the following code the error saying is not a known element. I think there is something wrong in the else part. Help me.
now I edited the quote and it still sends the same error. Is there something I'm missing. I'm very new to angular.
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-test',
template: `
<h2 *ngIf = "isVisible; else elseBlock" >
This is visible
</h2>
<ng-template #elseBlock>
<h2>
This is not visible.
</h2>
</ng-template>
` ,
styles: []
})
export class TestComponent implements OnInit {
public name = "Dipesh";
public isVisible = true;
constructor() { }
ngOnInit() {
}
}