I take this error for 2 reasons:
1) Component has to attach itself as a value accessor, like:
@Component({
selector: 'ace-editor',
template: `<div class="ng2-ace-editor"></div>`,
})
export class AceEditor implements OnInit, ControlValueAccessor {
constructor(private element: ElementRef, @Optional() ngControl: NgControl) {
if (ngControl) {
ngControl.valueAccessor = this;
}
}
2) You haven't to mix deprecated and new forms. If you use a new API add to your main.ts
:
import { bootstrap } from '@angular/platform-browser-dynamic';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import { AppComponent } from './app.component';
bootstrap(AppComponent, [
disableDeprecatedForms(),
provideForms()
])
.catch((err: any) => console.error(err));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…