简体   繁体   中英

angular webpack ng-file-upload

I'm trying to get ng-file-upload to work with my angularjs project, which uses webpack. I installed ng-file-upload via npm and added it to my main app.js

var ngFileUpload = require('../../node_modules/ng-file-upload/dist/ng-file-upload.min');
module.exports = angular.module('app', [ngFileUpload])

But I'm still getting:

Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module {} due to:
Error: [ng:areq] Argument 'module' is not a function, got Object

Could anyone tell me what I'm doing wrong, since I tried to find any information about this with no success.

Look for what ngFileUpload is exporting and what's the name of module. Right now you are injecting the module inside angular dependency but you need to just give name of your ngFileUpload module not the ngFileUpload it self. That's why you are getting this error. It's expecting a name of module but getting a object instead.

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