如何使用AngularJS訪問瀏覽器控制臺中的$Scope變量?我想進入我的$scope變量在Chrome的JavaScript控制臺中。我該怎么做?我都看不見$scope也不知道我的模塊名myapp在控制臺中作為變量。
4 回答

萬千封印
TA貢獻1891條經(jīng)驗 獲得超3個贊
// Access whole scopeangular.element(myDomElement).scope(); // Access and change variable in scopeangular.element(myDomElement).scope().myVar = 5;angular.element(myDomElement).scope(). myArray.push(newItem);// Update page to reflect changed variablesangular.element(myDomElement).scope().$apply();
$('#elementId').scope();$('#elementId').scope().$apply();
$0
.
angular.element($0).scope();

慕森卡
TA貢獻1806條經(jīng)驗 獲得超8個贊
var scope = angular.element('#selectorId').scope();
var scope = angular.element('[ng-controller=myController]').scope();
scope.$apply();
- 4 回答
- 0 關(guān)注
- 1141 瀏覽
添加回答
舉報
0/150
提交
取消