/
githubmirror
/
angular.js
Обзор
Документация
Войти
/
githubmirror
/
angular.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/e2e/fixtures/http/script.js
30 строк
773 B
Michał Gołębiowski
chore(*): switch from JSHint/JSCS to ESLint
05 авг 2016, 23:18
05 авг 2016, 23:18
c322032
Код
Авторство
О чём код?
'use strict'; angular. module('test', []). config(function($httpProvider) { $httpProvider.interceptors.push(function($q) { return { request: function(config) { return $q(function(resolve) { window.setTimeout(resolve, 100, config); }); }, response: function(response) { return $q(function(resolve) { window.setTimeout(resolve, 100, response); }); } }; }); }). controller('TestController', function($cacheFactory, $http, $scope) { var url = '/some/url'; var cache = $cacheFactory('test'); cache.put(url, 'Hello, world!'); $http. get(url, {cache: cache}). then(function(response) { $scope.text = response.data; }); });