Sfoglia il codice sorgente

Merge pull request #18 from daithiw44/master

Lungo.View.Template.Bindings: Change made replaces all occurrences.
Javier Jiménez 14 anni fa
parent
commit
9f4d3f768f
2 ha cambiato i file con 8 aggiunte e 6 eliminazioni
  1. 4 3
      release/lungo-1.0.1.js
  2. 4 3
      src/view/Lungo.View.Template.Binding.js

+ 4 - 3
release/lungo-1.0.1.js

@@ -833,12 +833,13 @@ LUNGO.View.Template.Binding = (function(lng, undefined) {
     };
 
     var _bindProperties = function(element, template) {
+		var regex;
         for (var property in element) {
             if (lng.Core.isOwnProperty(element, property)) {
-                template = template.replace(BINDING_START + property + BINDING_END, element[property]);
+				regex = new RegExp(BINDING_START + property + BINDING_END, "g");
+				template = template.replace(regex,element[property]);
             }
         }
-
         return _removeNoBindedProperties(template);
     };
 
@@ -1883,4 +1884,4 @@ LUNGO.Boot.Section = (function(lng, undefined) {
         start: start
     };
 
-})(LUNGO);
+})(LUNGO);

+ 4 - 3
src/view/Lungo.View.Template.Binding.js

@@ -66,12 +66,13 @@ LUNGO.View.Template.Binding = (function(lng, undefined) {
     };
 
     var _bindProperties = function(element, template) {
+		var regex;
         for (var property in element) {
             if (lng.Core.isOwnProperty(element, property)) {
-                template = template.replace(BINDING_START + property + BINDING_END, element[property]);
+				regex = new RegExp(BINDING_START + property + BINDING_END, "g");
+				template = template.replace(regex,element[property]);
             }
         }
-
         return _removeNoBindedProperties(template);
     };
 
@@ -89,4 +90,4 @@ LUNGO.View.Template.Binding = (function(lng, undefined) {
         dataAttribute: dataAttribute
     };
 
-})(LUNGO);
+})(LUNGO);