简体   繁体   中英

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

I'm pretty new to Angular and Meteor. I'm trying to create a project using Angular-Meteor .

A part of my Angular app.js is as follows.

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

I'm trying to use the Angular-ACL plugin.

When I run the app, I get the following error in the browser console.

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

Any ideas on what might have gone wrong?

OK I swear I was searching an answer for this since yesterday. But seems like I did not Google enough before posting this question. Really sorry about that.

Anyway I found the answer myself.The required tip came from the article [angularJS]How to use angular-acl?

I changed my code as follows and everything is working fine now.

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

The reason for this that(I think) the plugin Angular-ACL is defined in the angular-acl.js is as follows.

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

Hope this helps anyone else who's having a similar problem. Cheers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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