最佳答案
I generated new @Directive by Angular CLI, it was imported it to my app.module.ts
import { ContenteditableModelDirective } from './directives/contenteditable-model.directive';
import { ChatWindowComponent } from './chat-window/chat-window.component';
@NgModule({
declarations: [
AppComponent,
ContenteditableModelDirective,
ChatWindowComponent,
...
],
imports: [
...
],
...
})
and I try to use in my component (ChatWindowComponent)
<p [appContenteditableModel] >
Write message
</p>
even if within directive is only Angular CLI generated code:
import { Directive } from '@angular/core';
@Directive({
selector: '[appContenteditableModel]'
})
export class ContenteditableModelDirective {
constructor() { }
}
I got the error:
zone.js:388 Unhandled Promise rejection: Template parse errors: Can't bind to 'appContenteditableModel' since it isn't a known property of 'p'.
I tried almost every possible changes, following this angular docs everything should work but it does not.
Any help?