【发布时间】:2016-10-23 05:21:45
【问题描述】:
我正在通过刷新页面来更新我的视图。我知道有更好的方法。有人可以告诉我如何在不刷新页面的情况下更新视图数据:
myApp.service("deleteService", function ($http) {
this.removeRow = function (recId, compName, custName, docName) {
$http.post('DeleteRecord', { settingID: recId,companyName: compName,customerName: custName, documentName: docName } )
.success(function (data, status, headers, config) {
window.location.reload();
})
.error(function (data, status, header, config) {
});
}
});
【问题讨论】:
-
调用你用来获取视图数据的同一个函数,里面删除成功
-
更新视图是什么意思?更新模型绑定?在您的成功事件中,您可以在模型中设置绑定,并且视图将反映这些更改。
-
谢谢。你能告诉我怎么做吗。
标签: angularjs