I am currently facing a challenge in integrating a custom service from a Yeoman-created library into my existing Ionic2 project. The index.ts file of the library, which will be installed as an npm module, is structured as follows:
@NgModule({
imports: [
CommonModule
],
declarations: [
SampleComponent,
SampleDirective,
],
exports: [
SampleComponent,
SampleDirective,
SamplePipe
]
})
export default class SampleModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: SampleModule,
providers: [SampleService, SettingsSVC]
};
}
}
When attempting to inject SettingsSVC and the module.ts into my Ionic2 App by adding it to the imports section of the app.module, I encounter the following error:
Unexpected value 'SettingsSVC' imported by the module 'AppModule'
If I do not include it, a console error "provider not found" occurs.
Although the type (class irrespective of the @Injectable) is recognized and linked, I find that adding the same class directly to my Ionic2 App and its providers section in the module allows for successful injection.
Any advice on how to resolve this issue?