http({ m ethod:'GET', url:'/ Home / GetEmployeeList', params:{filterData:'Test'}, header :{'Content-Type':'application / x-www-form-urlencoded'} })。then(onSuccess,onError); var onSuccess = function(response){ this.user = response.data; this.error =''; }; var onError = function(reason){ this.error =检索数据时出错。; }; 返回此。用户; } }]); angular.module('Employee',['EmployeeServiceModule']) .controller('EmployeeController) ',['EmployeeSer','http({method: 'GET',url: '/Home/GetEmployeeList',params: { filterData: 'Test' },headers: { 'Content-Type': 'application/x-www-form-urlencoded' }}).then(onSuccess, onError);var onSuccess = function (response) {this.user = response.data;this.error = '';};var onError = function (reason) {this.error = "Error in retrieving data.";};return this.User;}}]);angular.module('Employee', ['EmployeeServiceModule']).controller('EmployeeController', ['EmployeeSer', ' 这篇关于在angularJs中从Service调用ajax时,它会在执行函数后转到服务器。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-30 04:42