上点击刷新视图Angularjs以获得最新的JSON数据 [英] Angularjs on click refresh view to get latest json data
本文介绍了上点击刷新视图Angularjs以获得最新的JSON数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Angularjs,我需要刷新视图只不是整个页面。我怎样才能做到这一点使用Angularjs。
I am using Angularjs and I need to refresh a view only not whole page. How can i do this using Angularjs.
我用 $ HTTP
服务得到JSON文件的数据,这就是为什么我需要更新缓存从JSON获得最新的值。
I have used $http
service to get a data from json file and that's why I need to update cache to get latest values from json.
$http.get('json/dashboard-home.json').success(function(data) {
$scope.campaigns = data; });
目前,如果我改变任何JSON文件它不是在页面上反映当我刷新页面的价值。每次我需要清除缓存来查看最新值。
Currently if I changed any value in json file it's not reflecting on a page when I refresh page. every time I need to clear cache to view latest value.
推荐答案
您可以禁用的$ HTTP缓存为prevent你的行为。
You can disable the cache of $http to prevent your behavior.
$http({
// ...
cache: false,
// ...
});
这篇关于上点击刷新视图Angularjs以获得最新的JSON数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文