I want to only set my attribute of ng-minlength
when the value I parse from data.Validation['minlength']
is not nil.
First I attempted using ng-switch
; I had no problem doing this when handling ng-show=true/false
. However I was unable to get it working when it was beyond just the value but also the whole declaration of ng-minlength="..."
. Second attempt was using ng-if
but again I was unable to get it working in the "middle" of the input.
Below is some code that works - I want the whole ng-minlength="data.Validation['minlength']"
to only be set if the value is not nil.
<input type="text" name="foo" ng-model="item.foo"
ng-minlength="data.Validation['minlength']" required/>