i got a Problem. I want a global Service. I found this: Link. It works but i want after initialized my component an event what is called after my component is bootstrapped.
Anyone know this event?
Lyror
Update
yes i want to do that:
import {GlobalService} from './GlobalService';
import {Component, provide, Injector, ComponentRef} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {HTTP_PROVIDERS} from 'angular2/http';
import {appInjector} from './app.injector';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS,
LocationStrategy, HashLocationStrategy} from 'angular2/router';
import {AppComponent} from './app.component';
bootstrap(AppComponent, [
ROUTER_PROVIDERS,
provide(LocationStrategy, { useClass: HashLocationStrategy }),
HTTP_PROVIDERS,
GlobalService
]).then((appRef: ComponentRef) => {
var injector = appInjector(appRef.injector);
var appComp: AppComponent = injector.get(AppComponent);
appComp.init();
});
But i get two Errors:
Unhandled Promise rejection: appComp.init is not a function ; Zone: ; Task: Promise.then ; Value: TypeError: appComp.init is not a function
Error: Uncaught (in promise): TypeError: appComp.init is not a function