简体   繁体   English

从流星包中导出角度模块

[英]Export angular module from meteor package

I am trying to make an angular module created inside a meteor package become visible to my application. 我正在尝试使在流星包中创建的角度模块对我的应用程序可见。 Below are the steps I performed: 以下是我执行的步骤:

1) create a package with the file mod-1.ng that registers a module 1)使用注册模块的文件mod-1.ng创建一个包

angular.module('mod-1', []);

2) added the file through package.js 2)通过package.js添加文件

Package.onUse(function(api) {
  api.addFiles(['mod-1.ng'], ['client']);
});

3) included the module dependency on my application code 3)在我的应用程序代码中包含了模块依赖性

angular.module('my-app', ['mod-1']); angular.module('my-app',['mod-1']);

Angular complains upon application startup Angular抱怨应用程序启动

Error: [$injector:nomod] Module 'mod-1' is not available! (...)

How can I make this angular module available to my application ? 如何使该角度模块可用于我的应用程序?

EDIT: this repository link may help reproduce the problem: https://github.com/ccortezia/angular-meteor-packaged-modules/tree/problem-1 编辑:此存储库链接可能有助于重现该问题: https : //github.com/ccortezia/angular-meteor-packaged-modules/tree/problem-1

Using .ng.js extension on javascript files solved the problem. 在javascript文件上使用.ng.js扩展名可以解决此问题。

In the past I used jnissi:ng-annotate, which happens to require .js files to be renamed to .ng. 过去我使用过jnissi:ng-annotate,它碰巧需要将.js文件重命名为.ng。 Nowadays angular-meteor seems to have it handled automatically by detecting and annotating files with extension .ng.js. 如今,角度流星似乎可以通过检测并注释扩展名为.ng.js的文件来自动处理它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM