@@ -23,7 +23,7 @@ export class LoadingComponent implements OnDestroy, OnInit {
2323 @Input ( ) message : string ;
2424 @Input ( ) showMessage = true ;
2525
26- @Input ( ) enableFallbackMessages = environment . loader . enableFallbackMessagesByDefault ;
26+ @Input ( ) showFallbackMessages = environment . loader . showFallbackMessagesByDefault ;
2727 @Input ( ) warningMessage : string ;
2828 @Input ( ) warningMessageDelay = environment . loader . warningMessageDelay ;
2929 @Input ( ) errorMessage : string ;
@@ -37,8 +37,6 @@ export class LoadingComponent implements OnDestroy, OnInit {
3737 readonly MessageType = MessageType ;
3838 messageToShow : MessageType = this . showMessage ? MessageType . LOADING : undefined ;
3939
40- private subscriptions : Subscription [ ] = [ ] ;
41-
4240 warningTimeout : any ;
4341 errorTimeout : any ;
4442
@@ -49,22 +47,12 @@ export class LoadingComponent implements OnDestroy, OnInit {
4947 }
5048
5149 ngOnInit ( ) {
52- if ( this . showMessage && this . message === undefined ) {
53- this . subscriptions . push ( this . translate . get ( 'loading.default' ) . subscribe ( ( message : string ) => {
54- this . message = message ;
55- } ) ) ;
50+ if ( this . showMessage ) {
51+ this . message = this . message || this . translate . instant ( 'loading.default' ) ;
5652 }
57- if ( this . enableFallbackMessages ) {
58- if ( ! this . warningMessage ) {
59- this . subscriptions . push ( this . translate . get ( 'loading.warning' ) . subscribe ( ( warningMessage : string ) => {
60- this . warningMessage = warningMessage ;
61- } ) ) ;
62- }
63- if ( ! this . errorMessage ) {
64- this . subscriptions . push ( this . translate . get ( 'loading.error' ) . subscribe ( ( errorMessage : string ) => {
65- this . errorMessage = errorMessage ;
66- } ) ) ;
67- }
53+ if ( this . showFallbackMessages ) {
54+ this . warningMessage = this . warningMessage || this . translate . instant ( 'loading.warning' ) ;
55+ this . errorMessage = this . errorMessage || this . translate . instant ( 'loading.error' ) ;
6856 if ( this . warningMessageDelay > 0 ) {
6957 this . warningTimeout = setTimeout ( ( ) => {
7058 this . messageToShow = MessageType . WARNING ;
@@ -81,11 +69,6 @@ export class LoadingComponent implements OnDestroy, OnInit {
8169 }
8270
8371 ngOnDestroy ( ) {
84- if ( this . subscriptions . length > 0 ) {
85- this . subscriptions . forEach ( ( sub ) => {
86- sub . unsubscribe ( ) ;
87- } ) ;
88- }
8972 if ( hasValue ( this . warningTimeout ) ) {
9073 clearTimeout ( this . warningTimeout ) ;
9174 }
0 commit comments