src/app/app.component.ts
encapsulation | ViewEncapsulation.None |
selector | app-root |
styleUrls | ./app.component.css |
templateUrl | ./app.component.html |
Properties |
Methods |
Accessors |
constructor(errorService: ErrorStore, sessionStore: SessionStore, router: Router, sanitizer: DomSanitizer, renderer: Renderer2, plaidService: PlaidService)
|
|||||||||||||||||||||
Defined in src/app/app.component.ts:19
|
|||||||||||||||||||||
Parameters :
|
ngOnInit |
ngOnInit()
|
Defined in src/app/app.component.ts:30
|
Returns :
void
|
hidePlaid |
Default value : true
|
Defined in src/app/app.component.ts:19
|
styleUrl |
Type : SafeUrl
|
Defined in src/app/app.component.ts:18
|
onTimeout |
getonTimeout()
|
Defined in src/app/app.component.ts:43
|
import 'rxjs/add/operator/filter';
import { Component, OnInit, ViewEncapsulation, Renderer2 } from '@angular/core';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { ErrorStore } from './providers/stores/error.store';
import { SessionStore } from './providers/stores/session.store';
import { PlaidService } from './providers/services/plaid.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None,
})
export class AppComponent implements OnInit {
styleUrl: SafeUrl;
hidePlaid = true;
constructor(
private errorService: ErrorStore,
private sessionStore: SessionStore,
private router: Router,
private sanitizer: DomSanitizer,
private renderer: Renderer2,
private plaidService: PlaidService
) {}
ngOnInit(): void {
this.sessionStore.session$
.filter((session) => session !== null)
.filter((session) => session !== undefined)
.filter((session) => session.styleUrl !== null)
.filter((session) => session.styleUrl !== undefined)
.filter((session) => session.styleUrl.length > 0)
.subscribe((session) => {
this.styleUrl = this.sanitizer.bypassSecurityTrustResourceUrl(session.styleUrl);
});
this.sessionStore.init();
}
get onTimeout() {
return () => {
// leave arrow fn () => to ensure this context is correct
this.errorService.showError('Session Timed Out', 'Redirecting....');
setTimeout(() => {
this.router.navigate(['/logout']);
}, 1000);
};
}
}
<link rel="stylesheet" [href]="styleUrl" />
<router-outlet></router-outlet>
<full-page-loader></full-page-loader>
<app-timeout [delegate]="onTimeout"></app-timeout>
<app-version-label></app-version-label>
./app.component.css