3 ms·
Yeah, and the good thing about ng-if compared to ng-show is that it removes the elements from DOM, rather than just hiding them, which is better for large datas
by aarongray 12y ago
Yeah, and the good thing about ng-if compared to ng-show is that it removes the elements from DOM, rather than just hiding them, which is better for large datasets.
- likeclockwork 12y agoAlso, maybe this isn't a common issue and would be solved by better designed models but.. using an ng-repeat against a list with some heterogeneous data.. ng-if works well to show only the UI components that apply to the object in question without rendering things for no reason and then hiding them. For example if you have a list of objects where some particular action might apply only to a portion of them.
- aarongray 12y agoI like it. We have seen a significant difference in performance in holding objects in our JS but not putting them in the DOM until the user needs to see them. I think the more you can remove from the DOM, the better.