码迷,mamicode.com
首页 > 数据库 > 详细

[AngularJS] Accessing Scope from The Console

时间:2014-11-30 00:12:20      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   ar   color   sp   for   on   div   

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.

bubuko.com,布布扣

 

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

标签:style   blog   http   ar   color   sp   for   on   div   

原文地址:http://www.cnblogs.com/Answer1215/p/4132179.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!