[AngularJS] ng-if vs ng-show

ng-show:

ng-show element will stay in dom, just added a ng-hide attr, so it won't show.

 

ng-if:

It has its own scope. 

Element is not display in the dom if not meet the requirements.

Better to use ng-if instead of ng-show.

 

https://egghead.io/lessons/angularjs-when-should-i-use-ng-show-or-ng-if#/tab-transcript

 

posted @ 2015-11-12 03:27  Zhentiw  阅读(299)  评论(0编辑  收藏  举报