2
我不知道为什么我的列表没有更新,点击了add
。它只在刷新时更新。这里是我的代码为什么我的列表只在刷新时更新
服务
function getCustomer() {
return $http.get(API_URL+'api/customer')
.then(getCustomerSuccess)
.catch(function(err) {
});
function getCustomerSuccess(response) {
return response.data;
}
}
的js
function getCustomer() {
dataServices.getCustomer()
.then(function(response){
vm.customer = response;
})
}
vm.add = function(customer) {
dataServices.addCustomer(customer);
getCustomer();
logger.success('Add Customer Success');
}
谢谢建议我会试试看。但是,你能解释一下为什么在这种情况下应该使用$ q –
@NguyễnBảoDũng查看这个例子:http://jsfiddle.net/oymubx4z/ –
这不是工作。我正在尝试使用不同的文件进行测试,它的工作原理。但在我的文件中,这是行不通的。我使用CORS,所以CORS与此相关或不相关? –