I have an angular application and I also created a module as npm package. This is the structure:
--otherModule
--other-module.module.ts
--index.ts
--package.json
index.ts:
export { OtherModule } from './other-module.module';
other-module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';;
@NgModule({
declarations: [ OtherComponent ],
imports: [
CommonModule
],
})
export class OtherModule {
}
After running npm link I'm trying to use this module in my AppModule like this:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { OtherModule } from 'other-module';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
OtherModule
],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {
}
But then I'm getting the following error:
Unexpected value 'OtherModule' imported by the module 'AppModule'. Please add a @NgModule annotation.
It seems like the decorator doesn't work or something. Any ideas?