Questions tagged «angular4-forms»

4
Angular4-没有用于表单控制的值访问器
我有一个自定义元素: <div formControlName="surveyType"> <div *ngFor="let type of surveyTypes" (click)="onSelectType(type)" [class.selected]="type === selectedType"> <md-icon>{{ type.icon }}</md-icon> <span>{{ type.description }}</span> </div> </div> 当我尝试添加formControlName时,出现错误消息: 错误错误:名称控件为'surveyType'的窗体控件没有值访问器 我尝试添加ngDefaultControl失败。似乎是因为没有输入/选择...,我不知道该怎么办。 我想将我的点击绑定到此formControl,以便当有人单击整个卡片时会将我的“类型”推入formControl。可能吗?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.