Click here to Skip to main content
15,918,243 members
Please Sign up or sign in to vote.
1.67/5 (2 votes)
See more:
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
Posted
Updated 31-Oct-16 20:31pm
v2

1 solution

If you are using Angular 1.1.5 or later then you should be able to use the ternary operator.
Something like -
HTML
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 :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900