Reputation: 169
After ran the project I got commonService.restDataService
is not a function error. Please help me into this. Thanks in advance.
(function() {
'use strict';
angular.module('formlyApp').factory('LoginService', ['$http', 'SessionService', 'commonService', 'AlertService',
LoginService
]);
function LoginService(SessionService, commonService, AlertService) {
commonService.restDataService(LOGIN_TOKEN_URL, data, null, clientName).then(function(response) {
if (response.data.jwt) {
SessionService.saveToken(response.data.jwt);
successHandler();
} else if (response.data.responseCode == 452) {
AlertService.addAlert('Invalid credentials');
}
}, function(response) {
if (response.status === 452) {
AlertService.addAlert('System Error');
} else {
AlertService.addAlert(response.data.message);
}
});
Upvotes: 1
Views: 227
Reputation: 25352
You have missed $http
in the parameter
Just convert this
function LoginService(SessionService, commonService, AlertService)
to this
function LoginService($http,SessionService, commonService, AlertService)
Upvotes: 1