更新的对象我的$范围值没有得到,而无需使用location.reload没有更新
嗨,我会得到API对象在那里我有更新一个值的列表,在更新模式弹出该值后,我如果不使用location.reload,我无法获得新的更新值。有没有其他解决方案,我使用两个不同的控制器。
Will get list of objects from this
$scope.groups=response.data
将NG-重复此组在那里,我的编辑按钮,每一行,一旦我点击编辑按钮,弹出窗口将打开
$scope.editGroup = function(u) {
$scope.groupName=u.groupName;
$scope.groupId=u.groupId;
ModalService.showModal({
templateUrl: 'app/components/modal/editGroupDetails.html',
controller: "ModalController",
scope: $scope
}).then(function(modal) {
modal.element.modal();
modal.close.then(function(result) {
$scope.message = "You said " + result;
});
});
};
下一次我编辑的组名,我会点击提交
$scope.updateGroupName=function(){
var data={
"groupId": $scope.groupId,
"groupName": $scope.groupName
}
url=globalUrlConfig.globalAdminApi+globalUrlConfig.updateGroup+$scope.schoolId;
$http({
method: 'PUT',
url: url,
data: data,
}).success(function(response) {
console.log(response)
if(response._statusCode==200){
alert(response.data);
location.reload();
}
else{
alert("not updated")
}
})
}
不使用location.reload我不能够显示更新的数据
您必须更新视图中显示的对象本身。 – Ladmerc
尝试通过使用唯一值(如id,索引 –