Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[angular] 4.ng-show/ng-hide 与 ng-if 的区别? #528

Open
qiilee opened this issue Oct 15, 2019 · 0 comments
Open

[angular] 4.ng-show/ng-hide 与 ng-if 的区别? #528

qiilee opened this issue Oct 15, 2019 · 0 comments
Labels

Comments

@qiilee
Copy link
Member

qiilee commented Oct 15, 2019

答案:我们都知道 ng-show/ng-hide 实际上是通过 display 来进行隐藏和显示的。而 ng-if 实际上控制 dom 节点的增删除来实现的。因此如果我们是根据不同的条件来进行 dom 节点的加载的话,那么 ng-if 的性能好过 ng-show.

@qiilee qiilee added the Angular label Oct 15, 2019
@qiilee qiilee added this to In progress in 每日一题认领区 Oct 15, 2019
@qiilee qiilee moved this from Angular to Done in 每日一题认领区 Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant