redoc/lib/components/LoadingBar/loading-bar.ts

23 lines
510 B
TypeScript
Raw Normal View History

2016-11-23 02:23:32 +03:00
'use strict';
2016-12-02 12:59:29 +03:00
import { Input, HostBinding, Component, OnChanges } from '@angular/core';
2016-11-23 02:23:32 +03:00
@Component({
selector: 'loading-bar',
template: `
<span [style.width]='progress + "%"'> </span>
`,
2017-02-14 13:01:09 +03:00
styleUrls: ['loading-bar.css']
2016-11-23 02:23:32 +03:00
})
2016-12-02 12:59:29 +03:00
export class LoadingBar implements OnChanges {
2016-11-23 02:23:32 +03:00
@Input() progress:number = 0;
@HostBinding('style.display') display = 'block';
ngOnChanges(ch) {
if (ch.progress.currentValue === 100) {
setTimeout(() => {
this.display = 'none';
}, 500);
}
}
}