私はangle-cliでAOTコンパイルセットアップをしようとしています。抽象クラスを継承するディレクティブがあります。コンパイル時に、抽象クラスがどのモジュールに属しているかを角度で判断できないエラーが発生しています。私はそれをNgModuleの宣言配列に追加することはできないので、これについて正しい方法は何でしょうか?私はそれが抽象的ではないにし、それを追加した場合、いくつかのデバッグ後に[OK]を角2角形AOTは、モジュール内の抽象クラスを宣言していますか?
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 { }
:私のコードの構造は次のようになり、
//...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.
}
エラーがこの
ERROR in Cannot determine the module for class TutorialDirective in /test-app/src/app/tutorial/directive/tutorial.directive.ts!
マイAppModuleのように見えます宣言は動作します。これは、クラスを抽象クラスとしてマークすることができないということですか?それは...ないと思える
モジュールのコードを追加します。app.module.ts – Aravind
@Aravind ok。宣言配列にTutorialDirectiveを追加することはできません。ちょうどあなたに知らせる。 – Steveadoo
私はそれを抽象化せず宣言に加えるとうまくいきます。これは、クラスを抽象クラスとしてマークすることができないということですか?それは正しいとは思わない... – Steveadoo