$scope.pause = function(userid){
var id = $scope.userid;
var status = 3;
getClients.status(id,status).then(function(response)
{
console.log('Response',response);
$scope.clients = response.data;
console.log('Data',$scope.clients);
$scope.cancel();
});
};
我在视图文件中通过单击更新它,并希望在视图文件中显示而不刷新它。
答案 0 :(得分:0)
解,
HTML
<div ng-controller="controllerName" ng-int="getData()">
</div>
JS
app.controller("name",fucntion(){
$scope.getData = function(){
//api call to get data from database
$scope.data = resultData;
}
$scope.yourEditFunction = function(){
//make API call to update data in database
$scope.getData();
}
})
但理想情况下,如果您将获取的API结果分配给$scope
变量,稍后在编辑功能中更新它,则无需刷新页面角度将为您更新数据。