javascript – 什么是范围.$$childHead?

我决定是时候探索测试指令的隐藏方面,现在当我对具有隔离范围的指令执行某些操作时:

parentScope = $rootScope.$new()
parentScope.dasDingy = "bla bla dingy"
element = angular.element("<foo dingy='dasDingy'></foo>")
$compile(element)(parentScope)
$rootScope.$digest()

scope = angular.element(element).scope()
console.log(scope.dingy) //  is undefined --- Nah, ain't exist
//  but, if I do
console.log(scope.$$childHead.dingy) // it exists and it's == 'bla bla dingy'

那么,什么是范围.$$childHead以及为什么它不能直接在范围内访问?
或者我在这里做些蠢事?

解决方法:

在这种情况下,范围.$$childHead是< foo>的隔离范围.指示.请参阅here in the source code指定此.$$childHead的位置和时间.有关使用具有不同类型范围(共享,隔离,新)的指令的示例,请参阅this plnkr中的控制台输出.

上一篇:javascript – 要求在CoffeeScript中配置库吗?


下一篇:javascript – 使用Coffeescript读取本地文件