From 35aec525ef8ac6eb1e274e89627c5c04fbbaa3df Mon Sep 17 00:00:00 2001 From: Bryce Hanscomb Date: Sun, 4 Jan 2015 17:08:05 +1100 Subject: [PATCH 1/2] Move comment inside relevant function This is a functional workaround for https://github.com/6to5/6to5/issues/376 And makes the comment code-style more consistent with line 143 and line 463. --- src/ngRoute/route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js index ad7bbc710b48..56ec491a207e 100644 --- a/src/ngRoute/route.js +++ b/src/ngRoute/route.js @@ -607,8 +607,8 @@ function $RouteProvider() { return $q.all(locals); } }). - // after route change then(function(locals) { + // after route change if (nextRoute == $route.current) { if (nextRoute) { nextRoute.locals = locals; From 189462bca98b017378d75eb8fa43063c78d5a0ec Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Mon, 5 Jan 2015 19:46:58 +0100 Subject: [PATCH 2/2] fix($templateRequest): cache downloaded templates as strings Fixes #10630 --- src/ng/templateRequest.js | 1 + test/ng/templateRequestSpec.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ng/templateRequest.js b/src/ng/templateRequest.js index 4d3989ce4904..81cea32d750a 100644 --- a/src/ng/templateRequest.js +++ b/src/ng/templateRequest.js @@ -42,6 +42,7 @@ function $TemplateRequestProvider() { return $http.get(tpl, httpOptions) .then(function(response) { + $templateCache.put(tpl, response.data); self.totalPendingRequests--; return response.data; }, handleError); diff --git a/test/ng/templateRequestSpec.js b/test/ng/templateRequestSpec.js index 2b695d6ab300..f4a245c86437 100644 --- a/test/ng/templateRequestSpec.js +++ b/test/ng/templateRequestSpec.js @@ -17,7 +17,7 @@ describe('$templateRequest', function() { })); it('should cache the request to prevent extra downloads', - inject(function($rootScope, $templateRequest, $httpBackend) { + inject(function($rootScope, $templateRequest, $templateCache, $httpBackend) { $httpBackend.expectGET('tpl.html').respond('matias'); @@ -34,6 +34,7 @@ describe('$templateRequest', function() { expect(content[0]).toBe('matias'); expect(content[1]).toBe('matias'); + expect($templateCache.get('tpl.html')).toBe('matias'); })); it('should throw an error when the template is not found',