为了账号安全,请及时绑定邮箱和手机立即绑定

请问return里面scope空对象存的是什么,求教老司机

myModule.directive("superman", function() {
   return {
       scope: {},
       restrict: 'AE',
       controller: function($scope) {
           $scope.abilities = [];
           this.addStrength = function() {
               $scope.abilities.push("strength");
           };
           this.addSpeed = function() {
               $scope.abilities.push("speed");
           };
           this.addLight = function() {
               $scope.abilities.push("light");
           };
       },
       link: function(scope, element, attrs) {
           element.addClass('btn btn-primary');
           element.bind("mouseenter", function() {
               console.log(scope.abilities);
           });
       }
   }
});

正在回答

2 回答

scope:{}是指创建独立的scope作用域

0 回复 有任何疑惑可以回复我~
#1

老汪仔 提问者

恩恩 谢谢你
2016-06-29 回复 有任何疑惑可以回复我~
2-11不就讲了么?
0 回复 有任何疑惑可以回复我~
#1

老汪仔 提问者

没往后看,就开始提问了,不好意思
2016-07-05 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
AngularJS实战
  • 参与学习       205512    人
  • 解答问题       1158    个

一起学习AngularJS的基础教程,通过实例学习并学会AngularJS

进入课程

请问return里面scope空对象存的是什么,求教老司机

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信