I am tired to translate these into Chinese.

but who cares? i write these posts just for myself

Scope

a new scope is created by the ng-controller directive using
the Scope.$new() method call.
yes , we need to have at least one instance of a scope before
creating a new scope!
so here is the $rootScope. it is the paremt of all the other
scopes. the $rootScope instance gets created when a new
application is bootstrapped.
each scope contains a property $parent which points to its parent scope.

ng-controller is a scope-created directive.
there are many other scope-created directives.

Scopes form a parent-child ,tree-like relationship rooted at
the $rootScope instance. and scopes' creation is driven by the DOM tree.

check the famous ng-repeat.
let's say a HTML snippet<li ng-repeat='per in persons'>{{per.name}}</li>
when interating persons, a new variable needs to be created to hold each per.
it seems the Google does not use the strategy that just simplely override previous value.
instead , it creats a new scope for each per and expose the scope to maybe the parent scope $scope.
in this way, it's possible to create variable with the same name on different scopes without createing name collisions.
in above snippet, every <li> element gets its own scope when the per variable can be defined.

as i say above ,each $scope except the $rootScope contains a property $parent which pointing to parent scope,
so all properties defined in parent scope is actually available to child scope.

Scope's inheritance in AngularJs follws the same rules as prototypical inheritance in JavaScript.(when we try to read
as property, the inheritance tree will be traversed upwards till a property is found.)

Scopes are responsible to creat variables.
they are to provide isolated namespaces and avoid name collisions.
they can be destroyed and the garbage collection will deallocate the resource.

最新文章

  1. HTML CSS中比较重要的
  2. Winpcap安装,Cannot open include file &#39;pcap.h&#39;
  3. php的if语句单行与多行
  4. 【BZOJ】3093: [Fdu校赛2012] A Famous Game
  5. 谈谈UIView的几个layout方法
  6. hdu3394--Railway(点的双连通分量)
  7. MVC知识总结(前序)
  8. 【 java版坦克大战--事件处理】 键盘控制小球上下左右移动
  9. #翻译# 深入JavaScript的Unicode难题(上)
  10. Java基础知识强化65:基本类型包装类之Integer的构造方法
  11. 疯狂delphi - 朱建强 (一些小例子很实用,也是我所关心的几个问题)
  12. nginx-tomcat-memcached架构文档说明(转)
  13. OpenCV 之 Mat 类
  14. jmeter系列-------脚本编写格式
  15. .NET面试常考算法
  16. js 颜色16进制转RGB方法
  17. Python基础——2函数
  18. 洛谷P3388 【模板】割点(割顶)
  19. Python基础语法总结
  20. System.IO.FileSystemWatcher

热门文章

  1. Memcache安装与使用
  2. iOSPOI检索详细总结
  3. Python 单元测试 之setUP() 和 tearDown()
  4. EasyNVR RTSP摄像机转HLS直播服务器中使用Onvif协议控制预置位
  5. Angular入门(二) 服务
  6. TCP(Socket基础编程)
  7. 一起来学linux:ACL
  8. Light OJ 1005 - Rooks 数学题解
  9. linux批量更改权限
  10. &lt;ReversingEngineering&gt;关于windows32位系统下的dll注入技术经验汇