我有一个文本区域,我想根据条件隐藏文本区域的文本
`<textarea class="form-control"
[ngClass]="{'pointer-events-none cursor-disabled' :
model.userPrivilage.canNewButNotEdit() }"
[(ngModel)]="model.repSetUp.DESCR" name="DESCR">
</textarea>`
答案 0 :(得分:1)
您可以做两件事,要么禁用文本区域,要么根据情况隐藏文本区域,我可以根据需要同时使用两种语言:
<-- Disable textarea -->
<textarea class="form-control"
[disabled]="model.userPrivilage.canNewButNotEdit()"
[(ngModel)]="model.repSetUp.DESCR" name="DESCR">
</textarea>
<-- hide textarea -->
<textarea class="form-control"
[ngClass]="{'hide
model.userPrivilage.canNewButNotEdit() }"
[(ngModel)]="model.repSetUp.DESCR" name="DESCR">
</textarea>
<-- hide text on codition -->
<textarea class="form-control"
[value]="(model.userPrivilage.canNewButNotEdit() ? '' : model.repSetUp.DESCR)"
[(ngModel)]="model.repSetUp.DESCR" name="DESCR">
</textarea>