I bought a template, which has all of its controllers, routes and directives in a single file app.js and this is my first angularJS app, I have defined Two controllers that I want to use them in the same view,the first is MailNewCtrl1 controller that will handle mail sending option in my form, and the second is FileUploadCtrl1 ,it handles attachments, my problem is that I have this error in the console:
Error: [$injector:unpr] Unknown provider: FileUploaderProvider <- FileUploader
http://errors.angularjs.org/1.3.2/$injector/unpr?p0=FileUploaderProvider%20%3C-%20FileUploader
at REGEX_STRING_REGEXP (http://localhost/ProjetWeb/src/vendor/angular/angular.js:80:12)
at http://localhost/ProjetWeb/src/vendor/angular/angular.js:3930:19
at Object.getService [as get] (http://localhost/ProjetWeb/src/vendor/angular/angular.js:4077:39)
at http://localhost/ProjetWeb/src/vendor/angular/angular.js:3935:45
at getService (http://localhost/ProjetWeb/src/vendor/angular/angular.js:4077:39)
at Object.invoke (http://localhost/ProjetWeb/src/vendor/angular/angular.js:4109:13)
at $get.extend.instance (http://localhost/ProjetWeb/src/vendor/angular/angular.js:8356:21)
at http://localhost/ProjetWeb/src/vendor/angular/angular.js:7608:13
at forEach (http://localhost/ProjetWeb/src/vendor/angular/angular.js:347:20)
at nodeLinkFn (http://localhost/ProjetWeb/src/vendor/angular/angular.js:7607:11) <div ui-view="" class="ng-scope">
this is how I used the two controllers:
<div ng-controller="MailNewCtrl1">
.........contact form(email,subject,message).........
<div class="form-group" ng-controller="FileUploadCtrl1" nv-file-drop="" uploader="uploader" filters="queueLimit, customFilter" >......<!--table of attachements!-->
.............</div>
</div>
app.js in which I defined the controllers:
'use strict';
angular.module('app', [
'ngAnimate',
'ngCookies',
'ngResource',
])
.controller('FileUploadCtrl1', ['$scope', 'FileUploader', function($scope, FileUploader) {
var uploader = $scope.uploader = new FileUploader({
url: 'upload.php'
});
// FILTERS
uploader.filters.push({
name: 'customFilter',
fn: function(item /*{File|FileLikeObject}*/, options) {
return this.queue.length < 10;
}
});
.....//the code is too long,this the controller in which I have problem
You are trying to inject a FileUploader
service, but don't appear to have defined that service in your app
module, nor are you depending on another module that might provide it for you.
You will need to do one or the other.
I'm guessing the FileUploader
is provided in another module. Make sure your module is dependend on that module:
angular.module('app', [
'ngAnimate',
'ngCookies',
'ngResource',
'FileUploader' // Name of the module goes here
])
var items = angular.module('items', []);
var text = angular.module('text', []);
text.controller('TextController', function ($scope) {
//Controller Code Here
});
items.controller('ItemController', function ($scope) {
//Controller Code Here
});