angular.element($0).scope()返回undefined

狠菜鸟的一个问题,勿喷^_^
我的代码是这样的,

<html >
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src = "js/angular.js"></script>
</head>
<body  ng-app = "myApp">

<div ng-controller="myCtrl" id = "div">
    <button ng-bind = "text.id" id = "btn"></button>
</div>
<script>
angular.module("myApp",[])
        .controller("myCtrl",["$scope",function($scope){
            $scope.text = {
                id:1,
                num:20
            };
        }]);



</script>
</body>
</html>

进行测试的时候,在控制台输出angular.element($0).scope().text的时候为什么会返回undefined。。。
跪求大神解答!!膜拜ing~

阅读 4.3k
1 个回答

楼主先在官方文档查阅一下, 什么是 Angular 里的 scope 以及 Angular和jQuery思维方式的差异.

推荐问题