I am trying to inject a service from a custom library created with yeoman into my existing ionic2 project. The index.ts of the lib (which will be installed as npm module) :
@NgModule({
imports: [
CommonModule
],
declarations: [
SampleComponent,
SampleDirective,
],
exports: [
SampleComponent,
SampleDirective,
SamplePipe
]
})
export default class SampleModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: SampleModule,
providers: [SampleService, SettingsSVC]
};
}
}
In my ionic2 App I want to inject SettingsSVC and the module.ts. If I add it to the imports-Section of the app.module it says :
Unexpected value 'SettingsSVC' imported by the module 'AppModule'
If not, I get a console error "provider not found".
The type (class regardless of the @Injectable) itself is recognized and linked and If I add the same class to my Ionic2 App and its providers section in the module it is working with Injection.
Any suggestions on how to make it work?