2014-11-16 78 views
-1

我按照教程閱讀文檔,但不明白我在做什麼錯誤。我總是得到。這裏就是我有

<!DOCTYPE html> 
<html ng-app="myApp"> 
<head> 
    <title></title> 
    <script type="text/javascript" src="bower_components/angular/angular.js"></script> 
    <script type="text/javascript" src="directives/communicate.js"></script> 

    <script type="text/javascript"> 
     var app = angular.module('myApp', []); 

     app.controller('abc', function($scope) { 

     }); 

     app.directive('abd', function() { 
      return { 
       restrict: 'AE', 
       controller: function($scope) { 
        $scope.tab = []; 
        console.log('hello') 

        this.tab = function() { 
         $scope.tab.push('test'); 
        } 
       } 
      } 
     }); 

     app.directive('def', function() { 
      return { 
       require: 'abc', 
       link: function(scope, element, attrs, abcCtrl) { 
        console.log(abcCtrl.tab); 
       } 
      } 
     }); 
    </script> 
</head> 
<body> 
    {{ 1 + 1 }} 
    <div def abc></div> 
</body> 
</html> 

在最後,我總是得到錯誤:[$編譯:ctreq]控制器「ABC」,由指令所要求的「高清」,不能被發現。怎麼來的 ?

回答

-2

Got it!這是一個錯字:(

app.directive('abd', function() { 
... 

應該

app.directive('abc', function() { 
... 
相關問題