angular.js:13424 Error: [ng:areq] Argument ‘XXX’ is not a function, got undefined

由于您在两个脚本上使用第一种方法,因此您基本上覆盖了先前创建的模块。

在加载的第二个脚本上,使用var myApp = angular.module(’myApp’);

angular.module('MyApp', [])
   .controller('MyCtrl', function($scope) {
       $scope.chart = 0;
       $scope.show = true;
    })
angular.module('MyApp')
 .directive('barCharts',function(){}

第二个和第一个如果开头一样

angular.module('MyApp', []) 则第二个会被第一个覆盖

未经允许不得转载:蒋丽君的小站 » angular.js:13424 Error: [ng:areq] Argument ‘XXX’ is not a function, got undefined

赞 (3)

评论

6+2=