-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.component.ts
38 lines (30 loc) · 1.18 KB
/
app.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {Component, OnInit, NgZone} from "@angular/core"
import {Observable} from "rxjs/Observable"
import {AuthenticationService, AuthenticationState} from "./services/authentication.service"
import {LanguageService} from "./services/language.service";
@Component({
selector: "fnb-app",
templateUrl: "app.component.html",
})
export class AppComponent implements OnInit {
constructor(private authService: AuthenticationService,
private languageService: LanguageService,
private zone: NgZone) {
}
ngOnInit() {
console.log("Initialized AppComponent");
this.authStatus = this.authService.authenticationStatus;
this.languageService.init(() => {
// Enforce re-rendering of whole Angular2 Page
window.setTimeout(() => {
this.zone.run(() => {
// This will trigger a re-render of the component associated with the zone, i.e. the app component
});
}, 100);
});
}
authStatus: Observable<AuthenticationState>;
refreshAuthentication() {
this.authService.refreshAuthentication();
}
}