Skip to main content

Posts

Showing posts with the label *ng-if else expression

Angular2 ngif else | Angular 2 ng-if else | ng-if else

The “ ngIf ” evaluates expression and then renders the “ else ” or “ then ” template in its place when expression is “truthy” or “falsy” respectively. Stayed Informed – Angular2 Interview Q/A Then : - This template is the inline template of “ ngIf ” unless bound to a different value. Else : - This template is blank unless it is bound. Selectors : - 1.       ngIf 2.       ngIfThen 3.       ngIfElse The syntax for the all above selectors as given below, //Syntax for ngIf <div * ngIf= "condition" > ... </div> <div template= "ngIf condition" > ... </div> <ng -template [ ngIf ]=" condition " ><div> ... </div> < /ng-template> //Syntax for else block <div * ngIf= "condition; else elseBlock" > ... </div> <ng -template # elseBlock > ... < /ng-template> //Syntax for then and else block <div * ngIf= "condi...