5
http://plnkr.co/edit/yhQQZxTxB8ZVFysqO6lP?p=previewangolare 2 Resolve Servizio Prima Bootstrap
Come posso assicurare il mio AuthService viene risolto prima che venga caricato AppComponent?
//main entry point
import {bootstrap} from '@angular/platform-browser-dynamic';
import {Http,HTTP_PROVIDERS} from '@angular/http';
import {App} from './app';
import {AuthService} from './auth.service';
import {provide, enableProdMode, APP_INITIALIZER} from '@angular/core';
bootstrap(App, [HTTP_PROVIDERS,
provide("isLoggedIn", { useFactory: (auth:AuthService) =>() => auth.login(), deps:[HTTP_PROVIDERS], multi: true }),
])
.catch(err => console.error(err));
Eventuali duplicati di http://stackoverflow.com/questions/38127741/angular-2-services-consuming-others-services- prima-call-a-metodo – estus