app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
textColor: String = "blue";
}
app.component.html
<h2>Angular Multiple Condition</h2>
<ng-template [ngIf] = "textColor == 'red'">
<h3 style="color: red;">Red color</h3>
</ng-template>
<ng-template [ngIf] = "textColor == 'green'">
<h3 style="color: green;">Green color</h3>
</ng-template>
<ng-template [ngIf] = "textColor == 'blue'">
<h3 style="color: blue;">Blue color</h3>
</ng-template>
<ng-template [ngIf] = "textColor == 'yellow'">
<h3 style="color: yellow;">Yellow color</h3>
</ng-template>
- angular - How to use if then condition
- angular - How to use if statement
- angular - How to use switch case default
- angular - How to use for loop
- angular - Text input on change listener
- angular - How to get text input value
- angular - How to create a counter
- angular bootstrap - Rating hover event
- angular bootstrap - Readonly & editable Rating
- angular bootstrap - How to show Toast message
- angular bootstrap - Popover manual triggers
- angular bootstrap - Popover custom CSS class
- angular bootstrap - Popover shown & hidden event
- angular bootstrap - Datepicker default visible year month
- angular bootstrap - How to show Datepicker in a popup