If it is the first, is it an effective way of programming, given that the elements may be 10 mb images or something? And what would be a better way?
Asked
Active
Viewed 469 times
0
-
1Better way would be to use `ng-if` instead of `ng-show`, so that DOM will get added only when it is needed to be there – Pankaj Parkar Jul 23 '16 at 20:36
-
1Check: [When to favor ng-if vs. ng-show/ng-hide?](http://stackoverflow.com/questions/21869283/when-to-favor-ng-if-vs-ng-show-ng-hide) – developer033 Jul 23 '16 at 20:37
1 Answers
0
ng-show/hide simple changes the display style, so the element is still loaded into the DOM regardless of the result.
You can use ng-if
to determine if an element should be loaded to the DOM or not. Documentation here

Ryan27
- 453
- 4
- 16