如何运行Pprod多个角度指令模块 [英] how to run more than one angular directive modules on Pprod

查看:426
本文介绍了如何运行Pprod多个角度指令模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作jhipster 0.7.0版本,我有app.first索引页和第二的commmon指令多类型在我们jhipster指令模块。

I am working on jhipster Release 0.7.0 and I have multiple type of directive modules in our jhipster app.first for index page and second for commmon directive.

当我们正式版上运行的配置文件,我得到一个例外: -

When we run on Prod profile i got an exception :-

[31mPhantomJS 1.9.7(Windows 7)中错误[39米错误:[$喷油器:NOMOD]
  模块共同服务不可!你要么拼写错误
  模块名称或忘记加载它。如果注册一个模块保证
  您指定的依赖作为第二个参数。
  的http://errors.angularjs.org/1.2.11-build.2192+sha.e2173f9/$injector/nomod?p0=common-services
  在
  D:/github_repo/gather-our-$c$c/src/main/webapp/bower_components/angular/angular.js:1531

[31mPhantomJS 1.9.7 (Windows 7) ERROR[39m Error: [$injector:nomod] Module 'common-services' 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.2.11-build.2192+sha.e2173f9/$injector/nomod?p0=common-services at D:/github_repo/gather-our-code/src/main/webapp/bower_components/angular/angular.js:1531

同样code正在制定的个人资料。

same code is working on develop profile ..

请帮我尽快解决这个bug

Please help me to solve this bug ASAP

推荐答案

在刺配置文件使用JavaScript缩小(由咕噜运行),这会降低你的JavaScript文件的大小。
由于这种修改您的JavaScript code,它可能会导致问题,这取决于你如何写你的依赖注入code。
你看提供的样本指令?或在样品控制器?你必须写你的依赖注入在相同的风格。

The "prod" profile uses JavaScript minification (run by Grunt), which will reduce the size of your JavaScript file. As this modifies your JavaScript code, it can cause issues, depending on how you write your dependency injection code. Have you looked at the sample directives that are provided ? Or at the sample controllers ? You must write your dependency injection in the same style.

例如,注入$范围:

jhipsterApp.controller('MainController', ['$scope',
    function ($scope) {
}]);

这将确保缩小过程中不会打破$范围变量的依赖注入。

This will ensure the minification process won't break dependency injection of the "$scope" variable.

如果你不能让它工作,你也可以从微小过程中排除文件:这取决于你的负担,但对于大多数应用,这是矫枉过正。此构造在Gruntfile.js文件

If you can't make it work, you can also exclude your files from the minification process: it depends on your load, but for most applications this is overkill. This is configured in your Gruntfile.js file.

这篇关于如何运行Pprod多个角度指令模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆