ng-if removes the actual element and there by bindings etc. within it, so if you embed a form element inside an ng-if and put validation on it, this is only present while the element is shown (the expression in ng-if evaluating to true)... Then can be usefull within forms where certain fields should only be present and validated under specific circumstances.
In cases where you just wish to allow the user to hide parts of a form (to enhance overview) but still wish to run the validation, you need to stick with ng-show/hide or put huge effort into alternatives, but I don't really see forms a magnitude that really makes a difference, if it give a noticeable performance boots to hide a few inputs, then I am sure there is something else wrong, e.g. bad bindings... On Wednesday, September 24, 2014 9:46:22 PM UTC+2, Bruno Ramos wrote: > > Today i change all ng-show in my code to ng-if. Now the performance of my > app good but i have problems with the view. > With ng-show i used the form.$valid to change some icons in the menu but > now using the ng-if the $valid don't work. > The $valid only work when i'm in the page, when i'm out the i lost the > menu icon. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
