mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 21:13:07 +00:00
38 lines
848 B
TypeScript
38 lines
848 B
TypeScript
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
|
|
import { Subscription } from 'rxjs/Subscription';
|
|
import { hasValue } from '../empty.util';
|
|
|
|
@Component({
|
|
selector: 'ds-loading',
|
|
styleUrls: ['./loading.component.scss'],
|
|
templateUrl: './loading.component.html'
|
|
})
|
|
export class LoadingComponent implements OnDestroy, OnInit {
|
|
|
|
@Input() message: string;
|
|
|
|
private subscription: Subscription;
|
|
|
|
constructor(private translate: TranslateService) {
|
|
|
|
}
|
|
|
|
ngOnInit() {
|
|
if (this.message === undefined) {
|
|
this.subscription = this.translate.get('loading.default').subscribe((message: string) => {
|
|
this.message = message;
|
|
});
|
|
}
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
if (hasValue(this.subscription)) {
|
|
this.subscription.unsubscribe();
|
|
}
|
|
}
|
|
|
|
}
|