quick note (parent/child directive context)
- shared scope (child directive’s property scope=false) parent/child share the same scope
- inherited scope (child directive’s property scope=true) child’s own scope that inherite from parent, and the scope’s property can be overwrite
- isolate scope (child directive’s property scope is an object) . And that object has nothing to with parent’s scope
$interpolate, $parse, $eval
|
|
shared/inherited scope(in controllers)
shared scope: parent and child use the same scope
|
|
inherited scope
controller 嵌套 controller scope和 directive里scope=true是一样的
都是创建一个inherit parent的scope, child scope有parent scope的方法或属性会shadow parent scope的属性
child scope没有的会从parent scope查找
|
|
以下两种情况, 模板声明使用shared scope但是实际使用inherited scope
- ng-include create it’s own inherited scope (like directive’s scope:true)
|
|
- ng-repeat
|
|