小编BSh*_*aps的帖子

根据条件禁用输入

大家好,我有以下代码:

<table class="details-table" *ngIf="peop && peopMetadata">
    <tr *ngFor="let attribute of peopMetadata.Attributes">
        <td class="details-property">{{attribute.AttributeLabel}}</td>
        <td [ngSwitch]="attribute.AttributeType">
            <div *ngSwitchCase="'String'">
                <input matInput [(ngModel)] = "peop[attribute.AttributeKey]" />
            </div>
            <div *ngSwitchDefault>{{peop[attribute.AttributeKey]}
            </div>
        </td>
    </tr>
    <div>
        <button ng-click="">Submit</button>
    </div>
</table>
Run Code Online (Sandbox Code Playgroud)

我想根据属性值禁用输入,比如 peop[attribute.IsWritable]='false' 。我怎么能在这里做到这一点。任何帮助表示赞赏

html typescript angular

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×1

html ×1

typescript ×1