如何检查Json文件更新,如果更新了,则用更新的数据刷新我的页面

how to check Json file update and if updated then refresh my page with updated data

本文关键字:更新 数据 刷新 我的 如果 检查 Json 文件 何检查      更新时间:2023-09-26

当我的json文件更新时,是否可以更新页面(视图)上显示的结果。

$http({
    method: 'GET',
    url: 'hotelResult.json'
})
.success(function(data, status) {
        $scope.data = data;
});

我在我的角度页面上显示这些数据,数据存储在Json文件中。我想在这个Json文件更新时更新页面,所以如果有任何解决方案,请分享。

提前谢谢。

https://docs.angularjs.org/api/ng/directive/ngCloak

ngCloak这就是你需要的!!