The most common usage of the NgIf directive is to conditionally show or hide the HTML templates. Now, you can write Angular if, else and then in HTML directly. The NgIf evaluates the expression and then renders the then or else template in its place when expression is true or false respectively. 1. Then template is the inline template of NgIf unless bound to a different value. 2. Else template is blank unless it is bound. Conditionally includes a template based on the value of an expression. @ Directive ({ selector: '[ngIf]' }) class NgIf { constructor ( _viewContainer : ViewContainerRef , templateRef : TemplateRef < NgIfContext >) set ngIf : any set ngIfThen : TemplateRef < NgIfContext > | null set ngIfElse : TemplateRef < NgIfContext > | null } Using Angular Template for ngIf - The < template > deprecated, now Angular 6 introduce ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers