首页 > 代码库 > [AngularJS] Accessing Scope from The Console
[AngularJS] Accessing Scope from The Console
Using Angular, you can actually access the scope and other things from the console, so when you have a live web page, you can dive in and grab things out of the scope and modify them and what not.
$0 is a shortcut for the selected element in your elements.
Then you can get the socpe by using:
var $scope = angular.element($0).scope();
Can use this $scope to change ng-Model‘s value, to get controller...or whatever.
Even you use controller as sytnx, you still can get by
$scope.myController
After you change the value, use:
$scope.$apply();
[AngularJS] Accessing Scope from The Console
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。