您好我是angularjs的新手,我正在尝试使用Restangular从服务调用中获取一些信息,我在检索数据时遇到了麻烦。以下是js文件的代码
angular.module('sol.user', ['restangular'])
.controller('sol.user.UserController',UserController)
.factory('sol.user.UserFactory',UserFactory);
UserFactory.$inject =['$rootScope', 'Restangular'];
UserController.$inject =['$rootScope', 'Restangular','sol.user.UserFactory'];
function UserFactory($rootScope, Restangular) {
alert("1");
var UserController = {};
var userDetails = Restangular.one('/user/userDetails');
var a = userDetails.post();
UserController = a;
return UserController;
}
function UserController($rootScope, Restangular, user){
$state.go('home.search');
}
function RestConfig(RestangularProvider) {
RestangularProvider.setBaseUrl('http://10.98.3.2:9081/CustomerService/');
RestangularProvider.setDefaultHttpFields({cache: false,timeout: 20000});
RestangularProvider.setDefaultHeaders({brand: "wp",userBsb: "032000"});
;
RestangularProvider.setFullRequestInterceptor(RequestInterceptor);
}
我无法点击服务网址,而我可以使用RESTClient检索数据。 什么似乎是问题? 另请告诉我Restangular.all / one /
之间的区别