在rabio按钮Angular中插入属性名称

时间:2018-06-18 20:26:18

标签: typescript angular5 angular6

我尝试在Angular 5 +中生成表单

HTML:

 <div class="row">
            <div *ngFor="let item of form; let i = index">
              <div class="col-sm-12">
                <div class="form-group">
                    <div *ngIf="item.type == 'radio' then radiocomp"></div>

                    <ng-template #radiocomp>
                        <label class="custom-control custom-radio">
                            <input id="{{item.id}}" name="{{item.name}}" [(ngModel)]="item.value" type="{{item.type}}" class="custom-control-input">
                            <span class="custom-control-indicator"></span>
                            <span class="custom-control-description">{{item.label}}</span>
                          </label>
                    </ng-template>
                </div>
              </div>
            </div>
          </div>

我有问题

<input id="{{item.id}}" name="{{item.name}}" [(ngModel)]="item.value" type="{{item.type}}" class="custom-control-input">

我的架构有两个类型为单选按钮的字段,属性名称在html中无法正确呈现,而name="tipo"ng-reflect-name="tipo,这使我的单选按钮无效。 [name]="item.type"也是如此。

我真的需要为我的收音机设置名称。有些想法?

0 个答案:

没有答案