initial i18n messages for loading and error components

This commit is contained in:
William Welling
2017-10-05 08:24:19 -05:00
parent 5b45871bff
commit cb72e4db07
13 changed files with 101 additions and 26 deletions

View File

@@ -1,5 +1,9 @@
import { Component, Input } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Subscription } from 'rxjs/Subscription';
@Component({
selector: 'ds-error',
styleUrls: ['./error.component.scss'],
@@ -9,4 +13,24 @@ export class ErrorComponent {
@Input() message = 'Error...';
private subscription: Subscription;
constructor(private translate: TranslateService) {
}
ngOnInit() {
if (this.message === undefined) {
this.subscription = this.translate.get('error.default').subscribe((message: string) => {
this.message = message;
});
}
}
ngOnDestroy() {
if (this.subscription !== undefined) {
this.subscription.unsubscribe();
}
}
}