So I am having troubles with managing dependencies for my node app. The structure is the following
app.js
var app = angular.module('myApp', ['myController', 'myFactory', 'rzModule', 'chart.js', 'myService', 'selector']);
myController.js
var app = angular.module('myApp', ['chart.js', 'rzModule', 'selector']);
app.controller('myController', function($scope, $http, $rootScope, myFactory, mySecondService){ ... }]);
myFactory.js
angular.module('myApp').factory('myFactory', function($http, $rootScope){ ... });
myService.js
angular.module('myApp').service('myService', function($http){...});
Above structure works, the app runs as expected. However I don't think what I am doing in myController.js is correct, because I now want to add another dependency and I can't figure out how to do so without the app crashing.
Question 1: In above myController.js, I think I am creating a new module instead of reusing the one from app.js, is that correct? If so, moving the 3 dependencies inline like the following results in "myController is not available":
var app = angular.module('myApp');
app.controller('myController',['chart.js', 'rzModule', 'selector', function(...)
Why does this not work? According to the documentation it should.
Question 2: I want to add angular-moment to the myController. The instructions say I should add 'angularMoment' as dependency to the app.js, and then 'moment' to the controller dependencies. If I do so and add 'moment' inline like in Question 1, I am getting again the "myController is not available" error.
app.controller('myController',['chart.js', 'rzMo....is the way to proceed, What is the sequence of the files?myControllerinside yourangular.module('myApp'decleration?'myController'from herevar app = angular.module('myApp', ['myController'