Javascript 角度范围;特例 让我们考虑一个非常简单的代码: <div id="main" ng-app='myapp' ng-init="qty=1;cost=2"> <div> Quantity: <input type="number" ng-model="qty"> </div> </div>
返回:Javascript 角度范围;特例 让我们考虑一个非常简单的代码: <div id="main" ng-app='myapp' ng-init="qty=1;cost=2"> <div> Quantity: <input type="number" ng-model="qty"> </div> </div>,javascript,angularjs,Javascript,Angularjs,返回: Scope {$id: 1, $$childTail: ChildScope, $$childHead: ChildScope, $$prevSibling: null, $$nextSibling: null…} 我的问题:如何通过控制台访问上述范围对象?当比较返回true时,我必须在右侧写什么 x.__proto__===*.Scope.prototype 由于x.\uuuuu proto\uuuuu返回作用域{}。这个作用域对象所在的位置?故意不向控制台公开作用域构造函数/函数
Scope {$id: 1, $$childTail: ChildScope, $$childHead: ChildScope, $$prevSibling: null, $$nextSibling: null…}
我的问题:如何通过控制台访问上述范围对象?当比较返回true时,我必须在右侧写什么
x.__proto__===*.Scope.prototype
由于
x.\uuuuu proto\uuuuu返回作用域{}
。这个作用域对象所在的位置?故意不向控制台公开作用域
构造函数/函数。它是在angular库中的IIFE深处定义的,特别是在$RootScopeProvider
函数中。您需要知道的是,您可以使用scope对象的$new()
方法创建新的作用域-您不需要直接访问此构造函数方法。故意不向控制台公开作用域构造函数/函数。它是在angular库中的IIFE深处定义的,特别是在$RootScopeProvider
函数中。您需要知道的是,您可以使用scope对象的$new()
方法创建新的作用域-您不需要直接访问此构造函数方法
x.__proto__===*.Scope.prototype