运行项目后我得到commonService.restDataService
不是函数错误。请帮帮我。提前谢谢。
(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);
}
});
答案 0 :(得分:1)
您在参数
中错过了$http
只需转换此
function LoginService(SessionService, commonService, AlertService)
到这个
function LoginService($http,SessionService, commonService, AlertService)