简体   繁体   中英

How to display different templates based on condition in angular

I am doing project in angular. In ts file I am getting array of string value. I may get 3 types string, based on condition.And at a time I will get only one string value in array. That may be 'First'or 'Second' or 'Third'.If I will get 'First' means I need to show different template, Second or third means different different template I need to display. I am not getting how to apply this condition on html file. Any help plz!!!

<ng-container *ngIf="condition1">Condition 1 stuff</ng-container>
<ng-container *ngIf="condition2">Condition 2 stuff</ng-container>
<ng-container *ngIf="condition3">Condition 3 stuff</ng-container>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM