阅读背景:

Angular2 *ngFor把数据显示在多个input中出错解决方法

来源:互联网 

点击添加按钮会自动添加一个空的input组

html

<div class="form-inline">
            <label class="form-control-label">属性</label>
            <button type="button" class="btn btn-test" (click)="addProperty()">添加</button>
        </div>
        <div class="properties" *ngIf="options.properties">
            <div class="property-inline" *ngFor="let property of options.properties; let idx=index">
                <div class="form-inline" >
                    <label class="form-control-label"></label>
                    <div class="input-group">
                        <div class="form-inline">
                            <input type="text" class="property-input" name="proName_field" [(ngModel)]="property.name">
                            <input type="{{property.secret ? 'password' : 'text'}}" class="property-input" name="proValue_field" [(ngModel)]="property.value" >
                            <input type="checkbox" [(ngModel)]="property.secret" name="secret_field">
                            <a (click)="deleteProperty(idx)"><i class="fa fa-trash color-red"></i></a>
                        </div>
                    </div>
                </div>
            </div>
        </div><div clas



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: