I am trying to configure AOT compilation using angular-cli. I have a directive that inherits from an abstract class, and during compilation I get a message that angular cannot determine which module the abstract class belongs to. I cannot add it to the NgModule declaration array, so is this the right way? My code structure looks like this:
//...imports export abstract class TutorialDirective { //...base class logic } @Directive({ selector: '[tut]', exportAs: 'tut' }) export class DefaultTutorialDirective extends TutorialDirective { //...calls into the base class for some shared stuff. }
The error looks like this:
ERROR in Cannot determine the module for class TutorialDirective in /test-app/src/app/tutorial/directive/tutorial.directive.ts!
My AppModule:
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { AppComponent } from './app.component'; import { TutorialService } from './tutorial/tutorial.service'; import { TutorialDirective, DefaultTutorialDirective } from './tutorial/directive/tutorial.directive'; @NgModule({ declarations: [ AppComponent, DefaultTutorialDirective ], imports: [ BrowserModule, FormsModule, HttpModule ], providers: [TutorialService], bootstrap: [AppComponent] }) export class AppModule { }
Well after some debugging, if I make it non-abstract and add it to the declarations, this works. Does this mean that I can not distinguish the class as abstract? That doesn't seem right ...
angular angular-cli
Steveadoo
source share