When to favor ng-if vs. ng-show/ng-hide?

前端 未结 7 1542
陌清茗
陌清茗 2020-11-22 08:39

I understand that ng-show and ng-hide affect the class set on an element and that ng-if controls whether an element is rendered as par

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 09:10

    ng-if on ng-include and on ng-controller will have a big impact matter on ng-include it will not load the required partial and does not process unless flag is true on ng-controller it will not load the controller unless flag is true but the problem is when a flag gets false in ng-if it will remove from DOM when flag gets true back it will reload the DOM in this case ng-show is better, for one time show ng-if is better

提交回复
热议问题