I am using button spinner while loading the content, when the user clicks on the \"Search\" button content will load, at this time buttonLabel will be changed t
For Angular2/4, you can use [hidden] to control the visibility of the spinner. Here is a Plunker.
Where spinning is defined in as:
And your component simply sets the boolean to control the visibility of the spinner. In this example, we simply spin for 10 seconds.
import {Component} from 'angular2/core';
import {Observable} from 'rxjs/Rx';
@Component({
selector: 'do-something',
templateUrl: 'src/dosomething.html'
})
export class DoSomething {
private spin: boolean = false;
onClickDoSomething() {
this.spin = true;
this.sub = Observable.interval(10000).subscribe(x => {
this.sub.unsubscribe();
this.spin = false;
});
}
}