I have an object that I want to share between my components into an Angular2 app.
Here is the source of the first component:
/* app.component.ts */
For the latest version of angular, if you want to share the service, you can't add it to the bootstrap function. Just add it to the NgModule providers list as you would do with a normal service, its default behaviour will be singleton.
bootstrap(AppComponent);
@NgModule({
declarations: [
....
],
imports: [
....
],
providers: [
ConfigService,
....