diff --git a/js/ngDialog.js b/js/ngDialog.js index c63627f0..b9206794 100644 --- a/js/ngDialog.js +++ b/js/ngDialog.js @@ -441,8 +441,6 @@ var template = setup.template, locals = setup.locals; - $templateCache.put(options.template || options.templateUrl, template); - if (options.showClose) { template += '
'; } @@ -605,7 +603,7 @@ return loadTemplateUrl(tmpl, {cache: false}); } - return $templateCache.get(tmpl) || loadTemplateUrl(tmpl, {cache: true}); + return loadTemplateUrl(tmpl, {cache: $templateCache}); } }, diff --git a/tests/ngDialog.spec.js b/tests/ngDialog.spec.js index 0779069e..c830f11e 100644 --- a/tests/ngDialog.spec.js +++ b/tests/ngDialog.spec.js @@ -80,6 +80,29 @@ describe('ngDialog', function () { })); }); + describe('with already cached template URL', function () { + var elm; + beforeEach(inject(function (ngDialog, $timeout, $document, $httpBackend, $compile, $rootScope) { + $httpBackend.whenGET('cached.html').respond('

some text {{1 + 1}}

'); + $compile('
')($rootScope); + + $rootScope.$digest(); + $httpBackend.flush(); + + var id = ngDialog.open({ + templateUrl: 'cached.html' + }).id; + + $timeout.flush(); + + elm = $document[0].getElementById(id); + })); + + it('should have compiled the html', inject(function () { + expect(elm.textContent).toEqual('some text 2'); + })); + }); + describe('controller instantiation', function () { var Ctrl; beforeEach(inject(function (ngDialog, $timeout, $q) {