@NgModule({
providers: [SomeService]
})
export class AppModule {}
Now, in angular 6 there is no need to do that and you can use the new providedIn property of @Injectable decorator:
import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root', //provided in the root module })
export class SomeService { constructor() { } }
//or if you need it in a different module, just add the module
import { Injectable } from '@angular/core';
import { MyModule } from './my.module';
@Injectable({ providedIn: MyModule, })
export class SomeService { constructor() { } }