mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 06:23:03 +00:00
initial i18n messages for loading and error components
This commit is contained in:
@@ -1,12 +1,36 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-loading',
|
||||
styleUrls: ['./loading.component.scss'],
|
||||
templateUrl: './loading.component.html'
|
||||
})
|
||||
export class LoadingComponent {
|
||||
export class LoadingComponent implements OnDestroy, OnInit {
|
||||
|
||||
@Input() message = 'Loading...';
|
||||
@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 (this.subscription !== undefined) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user