<mat-checkbox>
をReactiveFormに設定するときに問題があり、フォームコントロール用のアクセサーがありません。[...]テスト時。<mat-checkbox>を含むReactiveFormをテストするには?
私はdevモードでアプリケーションを実行すると、期待どおりに動作します。
本使用時:
Failed: No value accessor for form control with name: 'allDay'
Error: No value accessor for form control with name: 'allDay' at _throwError /node_modules/@angular/forms/@angular/forms.es5.js:1918:1) at setUpControl /node_modules/@angular/forms/@angular/forms.es5.js:1828:1) at FormGroupDirective.webpackJsonp.../../../forms/@angular/forms.es5.js.FormGroupDirective.addControl /node_modules/@angular/forms/@angular/forms.es5.js:4808:1) at FormControlName.webpackJsonp.../../../forms/@angular/forms.es5.js.FormControlName._setUpControl /node_modules/@angular/forms/@angular/forms.es5.js:5396:1) at FormControlName.webpackJsonp.../../../forms/@angular/forms.es5.js.FormControlName.ngOnChanges /node_modules/@angular/forms/@angular/forms.es5.js:5314:1) at checkAndUpdateDirectiveInline /node_modules/@angular/core/@angular/core.es5.js:10845:1) at checkAndUpdateNodeInline /node_modules/@angular/core/@angular/core.es5.js:12349:1) at checkAndUpdateNode /node_modules/@angular/core/@angular/core.es5.js:12288:1) at debugCheckAndUpdateNode /node_modules/@angular/core/@angular/core.es5.js:13149:22) at debugCheckDirectivesFn /node_modules/@angular/core/@angular/core.es5.js:13090:1)
しかし、コードは何の問題もなく、他の<mat-form-field>
秒間動作します:
<mat-checkbox
id="allDay"
type="checkbox"
formControlName="allDay">
<!-- i18n: @@event.allDay -->All Day Event?<!-- /i18n -->
</mat-checkbox>
をnpm test
を実行するときに、私はこのエラーを取得する
<mat-form-field>
<input
matInput
type="text"
formControlName="name">
</mat-form-field>
私のコンポーネントのテストで何かを提供しなければなりませんか?