Невозможно связать с 'ngModel', так как это не известное свойство 'quill-editor' - PullRequest
0 голосов
/ 26 апреля 2020

Я получаю ошибку Can't bind to 'ngModel' since it isn't a known property of 'quill-editor' в моем app-component-spe c .ts for line [ОШИБКА ->]

Код строки в QuestionListComponent.html:

<quill-editor class="description-row" [style]="editorStyle" [readOnly]="true" [modules]="editorConfig" [(ngModel)]="question.description"></quill-editor>

quill-editor является частью component QuillEditorComponent defined in QuillModule which I have imported in app.module.ts`.

imports: [
    AceEditorModule,
    QuillModule,

Почему я все еще получаю ошибку? Если я добавлю QuillEditorComponent явным образом снова в моем тесте, то получу ошибку

TestBed.configureTestingModule({
      declarations: [
        AppComponent,
QuillEditorComponent
      ],
      imports: [
        AppRoutingModule,
        QuillModule,
]
...
});

Type QuillEditorComponent is part of the declarations of 2 modules: QuillModule and DynamicTestModule! Please consider moving QuillEditorComponent to a higher module that imports QuillModule and DynamicTestModule. You can also create a new NgModule that exports and includes QuillEditorComponent then import that NgModule in QuillModule and DynamicTestModule.

Если я удаляю код [(ngModel)]="question.description", то код компилируется. Я не могу понять, что не так.

1 Ответ

0 голосов
/ 26 апреля 2020

Мне нужно было также добавить FormsModule. У меня было только ReactiveFormsModule в imports.

...