app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
message: string = "Lorem ipsum dolor sit amet,"
+ "consectetur adipiscing elit. In at ante mattis,"
+ "sollicitudin arcu id, dictum orci."
+ "Mauris laoreet tincidunt tellus vel faucibus."
isDisabled:boolean = false;
onClick(){
this.isDisabled = true;
setTimeout(()=>{
this.message = "I am changed after 10 seconds on button click."
}, 10000);
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular - How to use setTimeout()
</h2>
<button
(click)="onClick()"
[disabled]="isDisabled"
style="margin-bottom:20px; padding:12px;">
Change Text (delay 10 seconds)
</button>
<h3 style="color:blue;">
{{message}}
</h3>
- angular material - How to use indeterminate Progress spinner
- angular material - How to use determinate Progress spinner
- angular material - Progress spinner with percentage
- angular material - How to change Progress spinner size
- angular material - How to use Card
- angular material - How to use Tabs
- angular material - How to use custom label in Tabs
- angular material - How to slow Tabs content transition
- angular material - How to get Tabs selected index
- angular material - How to use Tabs selectedTabChange event
- angular material - How to delete Tab programmatically
- angular material - How to show remove button on Tab label
- angular material - How to show Tab label bottom of content
- angular material - How to change Slider width
- angular material - Tick interval auto in Slider