André Passos 676ba796ae
Changes to make SPA compatible with angular-cli AOT
Signed-off-by: André Passos <andre-ap2@hotmail.com>
2017-04-17 10:00:51 -03:00

41 lines
1.3 KiB
TypeScript

import { Title } from '@angular/platform-browser';
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { RouterModule } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { DataService } from './shared/services/data.service';
import { SecurityService } from './shared/services/security.service';
import { ConfigurationService } from './shared/services/configuration.service';
/*
* App Component
* Top Level Component
*/
@Component({
selector: 'esh-app',
styleUrls: ['./app.component.scss'],
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
Authenticated: boolean = false;
subscription: Subscription;
constructor(private titleService: Title, private securityService: SecurityService, private configurationService: ConfigurationService) {
this.Authenticated = this.securityService.IsAuthorized;
}
ngOnInit() {
console.log('app on init');
this.subscription = this.securityService.authenticationChallenge$.subscribe(res => this.Authenticated = res);
//Get configuration from server environment variables:
console.log('configuration');
this.configurationService.load();
}
public setTitle(newTitle: string) {
this.titleService.setTitle('eShopOnContainers');
}
}