Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit 02459fd

Browse files
committed
fixed template caching issue
1 parent 574bc15 commit 02459fd

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

dist/formly.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ angular.module('formly', ['formly.render']);
66
angular.module('formly.render').directive('formlyField', [
77
'$http',
88
'$compile',
9-
function formlyField($http, $compile) {
9+
'$templateCache',
10+
function formlyField($http, $compile, $templateCache) {
1011
var getTemplateUrl = function (type) {
1112
var templateUrl = '';
1213
switch (type) {
@@ -55,7 +56,7 @@ angular.module('formly.render').directive('formlyField', [
5556
link: function fieldLink($scope, $element, $attr) {
5657
var templateUrl = getTemplateUrl($scope.options.type);
5758
if (templateUrl) {
58-
$http.get(templateUrl).success(function (data) {
59+
$http.get(templateUrl, { cache: $templateCache }).success(function (data) {
5960
//template data returned
6061
$element.html(data);
6162
$compile($element.contents())($scope);

dist/formly.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/formly.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directives/formly-field.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
angular.module('formly.render')
3-
.directive('formlyField', function formlyField($http, $compile) {
3+
.directive('formlyField', function formlyField($http, $compile, $templateCache) {
44

55
var getTemplateUrl = function(type) {
66
var templateUrl = '';
@@ -53,7 +53,9 @@ angular.module('formly.render')
5353
link: function fieldLink($scope, $element, $attr) {
5454
var templateUrl = getTemplateUrl($scope.options.type);
5555
if (templateUrl) {
56-
$http.get(templateUrl).success(function(data) {
56+
$http.get(templateUrl, {
57+
cache: $templateCache
58+
}).success(function(data) {
5759
//template data returned
5860
$element.html(data);
5961
$compile($element.contents())($scope);

0 commit comments

Comments
 (0)