i am trying to add a new Module to my application. My HTML for index page is
<body ng-app="com.app">
In my app.js
angular.module('mod1', ['ngResource']);
angular.module('mod2', []); //this is module i want to add
var app = angular.module('com.app', ['ngResource','mod1','mod2']);
My Controllers1.js
var Controllers = angular.module('mod1');
Controllers.controller('ctrl1', function($scope,$http) {});
Controllers.controller('ctrl2', function($scope,$http) {}); //function for module 2
when i try to add this ctrl2 to my "controllers1.js" it works , but if i add this in my other js say "controllers2.js", its not working . My controllers2.js is
'use strict';
var mymodule = angular.module('mod2');
mymodule.controller('ctrl2', function() {
console.debug("Testing...");
});
summary of my question is : when i try to add my ctrl2 function to new module, its not working and on firefox console i am getting error
Error: Argument 'ctrl2' is not a function, got undefined
assertArg@http://localhost:8080/tm-webapp/resources/lib/angular.js:1039
assertArgFn@http://localhost:8080/tm-webapp/resources/lib/angular.js:1050
@http://localhost:8080/tm-webapp/resources/lib/angular.js:4802
update@http://localhost:8080/tm-webapp/resources/lib/angular.js:14198
Scope.prototype.$broadcast@http://localhost:8080/tm-webapp/resources/lib/angular.js:8307
updateRoute/<@http://localhost:8080/tm-webapp/resources/lib/angular.js:7463
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:8080/tm-webapp/resources/lib/angular.js:6846
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:8080/tm-webapp/resources/lib/angular.js:6846
qFactory/ref/<.then/<@http://localhost:8080/tm-webapp/resources/lib/angular.js:6883
Scope.prototype.$eval@http://localhost:8080/tm-webapp/resources/lib/angular.js:8057
Scope.prototype.$digest@http://localhost:8080/tm-webapp/resources/lib/angular.js:7922
Scope.prototype.$apply@http://localhost:8080/tm-webapp/resources/lib/angular.js:8143
done@http://localhost:8080/tm-webapp/resources/lib/angular.js:9170
completeRequest@http://localhost:8080/tm-webapp/resources/lib/angular.js:9333
createHttpBackend/</xhr.onreadystatechange@http://localhost:8080/tm-webapp/resources/lib/angular.js:9304
I am stuck here for a long, kindly help me i shall be very thankful. Regards,