Answer the question
In order to leave comments, you need to log in
How to put data into Angular's $http cache?
Good afternoon, in Angular, requests have a very convenient cache parameter.
$http.get('api',{
cache: true
}
var dataCache = $cacheFactory.get('Cache');
$http.get('api',{
cache: dataCache
}
Answer the question
In order to leave comments, you need to log in
And the casket just opened.
//формат данных кеша, где data массив с данными
var cache = [
200,
data,
{"content-type": "application/json"},
"OK"
]
//url - полный путь запроса
$cacheFactory.get('$http').put(url, cache);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question