I have a angular app with following structure
masterApp.js :
var masterApp = angular.module('masterApp', []);
masterApp.factory("organizationFactory", ["$http", organizationFactory(http)]);
masterApp.controller("organizationCtrl", ["$scope", "organizationFactory",organizationCtrl(scope,organizationFactory)]);
organizationFactory.js:
function organizationFactory(http) {
return {
getDefaultOrganization:function() {
http.get(organizationRestUrl);
},
registerOrganization:function(organization) {
http.post(organizationRestUrl, organization);
},
updateOrganization:function(organization) {
http.put(organizationRestUrl, organization);
},
deleteOrganization:function() {
http.delete(organizationRestUrl);
}
};
}
OrganizationCtrl.Js
function organizationCtrl($scope,organizationFactory) {
alert(scope);
scope.organization = organizationFactory.getDefaultOrganization();
}
When app runs i got an error
ReferenceError: http is not defined
masterApp.factory("organizationFactory", ["$http", organizationFactory(http)])
I changed to injecting http to $http and scope to $scope ( i think it will not cause the error because i am using appropriate minfication safe guidelines) .but still i am stuck with that error NB: I am sure that angular.js loading before the script