0

这是我的问题...

我用 gruntFile.js 准备下一个小例子,我可以缩小这个

这是我的错误:

Uncaught Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.3.11/$injector/nomod?p0=myApp

这是查看我的示例的链接:

https://github.com/juliovg/minification_Test.git

有人可以帮助我吗?

谢谢

4

1 回答 1

1

第一件事删除一个ng-app="myApp"指令来初始化,因为它已经声明了你两次。您必须遵循依赖注入的数组注释以确保正确缩小而不会出错,您在指令中错过了它。

指示

angular.module('myApp')
.directive('beerFormDirective',[ function() {
    return {
        restrict: 'AE',
        templateUrl: 'js/directives/beerForm/beerForm_view.html',
        scope: {},
        controller: 'beerForm_controller' //added controller from view
    };
}]);

ng-controller从您的 html 模板中删除。& 为了获得更好的性能,请从本地而不是从 cdn 加载 javascript 文件

于 2015-03-16T19:04:51.323 回答