如何在角度js-中进行基于条件的必需验证(ng-required) [英] How to do conditional based required validation in angular js-(ng-required)
问题描述
ng-required ='editing == false? true:false'>
我尝试过:
嗨伙计们,
如何做基于条件的必要验证购买使用ng-requird我已经给出了我的代码。我试过这个但我无法得到正确的输出。如果您使用的正确解决方案。 js / blob / master / CHANGELOG.md#115-triangle-squarification-2013-05-22> Angular 1.1.5或更高版本
然后你应该能够使用三元运算符。
类似于 -
ng-required ={{editing == false?true:false}}
我认为,对于这个特殊的任务,你可以尝试只是否定值而不是任何条件运算符。
希望,它有帮助:)
ng-required='editing == false ? true : false'>
What I have tried:
hi guys,
how to do conditional based required validation buy using ng-requird i have given below my code .i tried this but i couldn't get the proper output .so can you please send me that proper solution for this
If you are using Angular 1.1.5 or later then you should be able to use the ternary operator.
Something like -
ng-required="{{editing == false ? true : false}}"
I think, for this particluar task, you can try just negating th value instead of any conditional operator.
Hope, it helps :)
这篇关于如何在角度js-中进行基于条件的必需验证(ng-required)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!