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面试题 #26

Open
Wscats opened this issue Oct 13, 2016 · 3 comments
Open

angular面试题 #26

Wscats opened this issue Oct 13, 2016 · 3 comments

Comments

@Wscats
Copy link
Owner

Wscats commented Oct 13, 2016

解释下什么是 $rootScrope 以及和 $scope 的区别
$rootScrope 页面所有 $scope 的父对象
Angular解析 ng-app 然后在内存中创建 $rootScope
带有ng-controller的div然后指向到某个controller函数。这个时候在这个controller函数中变有一个$scope对象实例

Angular Directive中restrict 中分别可以怎样设置
restrict中可以分别设置:

  • A 匹配属性
  • E 匹配标签
  • C 匹配class
  • M 匹配注释

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

列出至少三种实现不同模块之间通信方式

  • Service
  • events,指定绑定的事件
  • 使用$rootScope
@qfliailian
Copy link

实现不同模块之间的通信方式中,events,指定绑定的事件,不是很清楚……

@paul1605
Copy link

哈哈 不错 学习中·····

@fangqikuai
Copy link

老姚,我今天被问到自定义的directive怎么给别人使用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants