如何在 angular-meteor 项目中使用 angular-acl?

How to use angular-acl in a angular-meteor project?

我对 Angular 和 Meteor 还很陌生。我正在尝试使用 Angular-Meteor.

创建一个项目

我的一部分Angularapp.js如下

import AclService from 'angular-acl';
angular.module('myApp', [angularMeteor, uiRouter,AclService, 'accounts.ui']);

我正在尝试使用 Angular-ACL 插件。

当我 运行 应用程序时,我在浏览器控制台中收到以下错误。

VM4605 modules.js?hash=afc491d…:232 Uncaught Error: [$injector:modulerr] 

Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module {} due to:
Error: [ng:areq] Argument 'module' is not a function, got Object
http://errors.angularjs.org/1.5.3/ng/areq?p0=module&p1=not%20a%20function%2C%20got%20Object
    at http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:232:12
    at assertArg (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:2008:11)
    at assertArgFn (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:2018:3)
    at http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4697:11
    at forEach (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:485:20)
    at loadModules (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4672:5)
    at http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4689:40
    at forEach (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:485:20)
    at loadModules (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4672:5)
    at createInjector (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4594:19)
http://errors.angularjs.org/1.5.3/$injector/modulerr?p0=%7B%7D&p1=Error%3A%…2Fmodules.js%3Fhash%3Dafc491df237c732f4ec721460c9455fc18cc0d9d%3A4594%3A19)
    at http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:232:12
    at http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4711:15
    at forEach (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:485:20)
    at loadModules (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4672:5)
    at http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4689:40
    at forEach (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:485:20)
    at loadModules (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4672:5)
    at createInjector (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:4594:19)
    at doBootstrap (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:1874:20)
    at bootstrap (http://localhost:3000/packages/modules.js?hash=afc491df237c732f4ec721460c9455fc18cc0d9d:1895:12)
http://errors.angularjs.org/1.5.3/$injector/modulerr?p0=myApp&p1=Er…2Fmodules.js%3Fhash%3Dafc491df237c732f4ec721460c9455fc18cc0d9d%3A1895%3A12)(anonymous function) @ VM4605 modules.js?hash=afc491d…:232(anonymous function) @ VM4605 modules.js?hash=afc491d…:4711forEach @ VM4605 modules.js?hash=afc491d…:485loadModules @ VM4605 modules.js?hash=afc491d…:4672createInjector @ VM4605 modules.js?hash=afc491d…:4594doBootstrap @ VM4605 modules.js?hash=afc491d…:1874bootstrap @ VM4605 modules.js?hash=afc491d…:1895angularInit @ VM4605 modules.js?hash=afc491d…:1780(anonymous function) @ VM4605 modules.js?hash=afc491d…:30873fire @ VM4606 jquery.js?hash=649d9f4…:3185self.fireWith @ VM4606 jquery.js?hash=649d9f4…:3297jQuery.extend.ready @ VM4606 jquery.js?hash=649d9f4…:3509completed @ VM4606 jquery.js?hash=649d9f4…:3540

对可能出现的问题有什么想法吗?

好的,我发誓从昨天开始我就在寻找这个问题的答案。但似乎我在发布这个问题之前没有 Google 足够。真的很抱歉。

总之我找到了答案myself.The 所需提示来自文章[angularJS]How to use angular-acl?

我按如下方式更改了我的代码,现在一切正常。

angular.module('myApp', [angularMeteor, uiRouter,'mm.acl', 'accounts.ui']);

(我认为)插件 Angular-ACL 在 angular-acl.js 中定义的原因如下。

angular.module('mm.acl').provider('AclService', [
  function () {

希望这对遇到类似问题的其他人有所帮助。干杯!