I am working with blade template engine. I want to follow a convention of "One Controller per Page" to easily handle code. I have one JS file which has few controllers which will be used in all files/pages So i included in my template file which will automatically generated in each page. Code is as follows
angular.module('MyApp',['angularFileUpload'])
.factory('MyFactory', ['$http',function($http) {
return{
get: function(callback){
$http.get('my-url')
.success(function(data) {
callback(data);
});
}
};
}])
.controller('GlobalController',['$scope','$http','MyFactory',function($scope,$http,MyFactory){
SchoolFactory.get(function(data){
console.log(data);
});
// Few Function which will be called in all pages
}]);
Now When create a new page using that template that includes above JS, I get error. Here is what I create new js file.
angular.module('MyApp',[])
.controller('SomeController',['$scope','$http',function($scope,$http){
// Few Function which will be called in all pages
}]);
Any Page which include this module i get error in console that SomeController is not a function.
Please help me. Thanks in advance.