import { Component , OnInit } from '@angular/core' ; import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap' ; import { JhiEventManager } from 'ng-jhipster' ; import { LoginModalService , AccountService , Account } from 'app/core' ; @ Component ( { selector : 'jhi-home' , templateUrl : './home.component.html' , styleUrls : [ 'home.scss' ] } ) export class HomeComponent implements OnInit { account : Account ; modalRef : NgbModalRef ; constructor ( private accountService , private loginModalService , private eventManager ) { } ngOnInit ( ) { this . accountService . identity ( ) . then ( ( account ) => { this . account = account ; } ) ; this . registerAuthenticationSuccess ( ) ; } registerAuthenticationSuccess ( ) { this . eventManager . subscribe ( 'authenticationSuccess' , message => { this . accountService . identity ( ) . then ( account => { this . account = account ; } ) ; } ) ; } isAuthenticated ( ) { return this . accountService . isAuthenticated ( ) ; } login ( ) { this . modalRef = this . loginModalService . open ( ) ; } }