I have the following:
angular.module('app', [ 'ngNewRouter', 'security',
and security module
angular.module('security', ['ngNewRouter'])
.factory('authService', ['$http', '$q', '$window', 'CONSTANTS', '$location', '$router', authService ]);
function authService($http, $q, $window, CONSTANTS, $location, $router) {
var service = {};
//tries to login user
var _login = function(loginData) {
var data = {
"email": loginData.email,
"password": loginData.password
};
$http.post(CONSTANTS.baseURL + '/login', data)
.success(function(data, status, headers, config) {
_authenticate(data);
--->>> $router and $location --->>> not defined here, although $http, $q, $window, CONSTANTS are defined
})
.error (function (data, status, headers, config) {
_logOut();
});
};
Why is $router and $location not defined inside that function, and the others are? What am I missing?
I also tried defining security module with and without ngNewRouter