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 = "green";
}
app.component.html
<h2>Angular Swith Case Default</h2>
<div [ngSwitch]="textColor">
<h3 *ngSwitchCase="'red'" style="color: red ;">
Red color
</h3>
<h3 *ngSwitchCase="'green'" style="color: green ;">
Green color
</h3>
<h3 *ngSwitchCase="'blue'" style="color: blue ;">
Blue color
</h3>
<h3 *ngSwitchCase="'yellow'" style="color: yellow ;">
Yellow color
</h3>
<h3 *ngSwitchDefault>
Unknown color
</h3>
</div>
- angular - How to create function
- angular - Display value using interpolation
- angular - Interpolation JavaScript method
- angular - Interpolation call method
- angular - How to use if then condition
- angular - How to use if statement
- angular - Multiple condition
- angular - How to use for loop
- angular - How to bind style
- angular - How to bind multiple style
- angular - Text input on change listener
- angular - How to get text input value
- angular - How to create a counter
- angular bootstrap - How to show striped Progressbar
- angular bootstrap - Light & dark Progressbar