angular中filter使用和缓存jsonp数据

angular缓存jsonp数据:

参考自:https://www.chedanji.com/angularjs-cache-for-jsonp/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
angular.module('app',[])
.factory("myCache", function($cacheFactory){
return $cacheFactory("me");
})
.controller("AppCtrl", function($http, myCache){
var app = this;
app.load = function(){
$http.get("apiurl",{cache:myCache})
.success(function(data){
app.data = data;
})
}
app.clearCache = function(){
myCache.remove("apiurl");
}
})

$filter使用方法:

1
$filter('filter')(objData, { $: n });
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×