我正在尝试为我的所有指令创建一个单独的模块。因为我没有将所有指令导入app.module,而是创建了一个单独的模块。这里是代码
directive.module.ts
import { NgModule, Injectable, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { Tab } from './activetab.directive';
import { JqtDirective } from './jqte-editor.directive';
@NgModule({
declarations: [
Tab,
JqtDirective
],
imports: [
FormsModule,
BrowserModule
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class DirectivesModule { }
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, Injectable, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
......
......
import { DirectivesModule } from './shared/directives/directives.module';
@NgModule({
declarations: [ ],
imports: [
BrowserModule,
FormsModule,
DirectivesModule
],
providers: [ABCService],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
bootstrap: [AppComponent]
})
export class AppModule { }
我收到以下错误
zone.js:388 Unhandled Promise rejection: Template parse errors:
Can't bind to 'jqtevalue' since it isn't a known property of 'textarea'. (" <fieldset>
<textarea jqte-editor [ERROR ->][jqtevalue]="details" cols="20" id="noise" name="noise" class="nothing"></textarea>
此处 jqte-editor 是我的选择器名称。帮助我解决导致问题的原因。