I have a custom element :(我有一个自定义元素:)
<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>
When I try to add the formControlName, I get an error message:(当我尝试添加formControlName时,出现错误消息:)
ERROR Error: No value accessor for form control with name: 'surveyType'(错误错误:名称为“ surveyType”的表单控件无值访问器)
I tried to add ngDefaultControl
without success.(我尝试添加ngDefaultControl
失败。) It seems it's because there is no input/select... and I dont know what to do.(似乎是因为没有输入/选择...,我不知道该怎么办。)
I would like to bind my click to this formControl in order that when someone clicks on the entire card that would push my 'type' into the formControl.(我想将我的点击绑定到此formControl,以便当有人单击整个卡片时会将我的“类型”推入formControl。) Is it possible?(可能吗?)
ask by jbtd translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…