Angular4_readonly,disabled,hidden属性动态启用禁用

前端之家收集整理的这篇文章主要介绍了Angular4_readonly,disabled,hidden属性动态启用禁用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

html中的

required hidden readonly disabled

这些属性,动态启用禁用

< div class= "form-group" [ hidden]= "model.isPersistent" >
< label for= "idletimeout" >IdleTimeOut </ label >
< input type= "text" class= "form-control" id= "idletimeout" [( ngModel)]= "model.idleTimeout" [ required]= "!model.isPersistent" name= "idleTimeout" value= '60' # idletimeout= "ngModel" >
< div [ hidden]= "idletimeout.valid || idletimeout.pristine" class= "alert alert-danger" >
IdleTimeOut is required
</ div >
</ div >
< button type= "submit" class= "btn btn-success" [ disabled]= "!addEditWorkStationForm.form.valid" >Submit </ button >

就拿这段代码为例,原本的hidden加上[]就能实现了。

原理不多说,先会用再说啦

原文链接:https://www.f2er.com/angularjs/145333.html

猜你在找的Angularjs相关文章