Skip to content
Advertisement

Tag: angular-directive

Angular directive not working with ng-container

The given below code ng-if is not working as expected if displayGroup value is D then it will print the first and Second block, did I made any mistake Answer If you want to check bookTravelInfo.displayGroup is either ‘A’ or ‘B’ or ‘C’, Use || Logical OR operator from your *ngIf will never return false. As the boolean result returned

Angular why asterisk (*)

In Angular document, * and template, we know that the *ngIf, *ngSwitch, *ngFor can be expanded to ng-template tag. My question is: I think the ngIf or ngFor without * can also be translated and expanded to template tag by Angular engine. The following code would be the same as So why bother designing a strange symbol asterisk(*) in Angular?

Advertisement