diff options
-rw-r--r-- | ng-vaadin.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ng-vaadin.js b/ng-vaadin.js index 760a85b..d902b98 100644 --- a/ng-vaadin.js +++ b/ng-vaadin.js @@ -22,21 +22,19 @@ attributes : true }); - scope.$watch(function() { - for ( var attr in attrMap) { - var value = element.attr(attr); - var tokens = attrMap[attr].split(/\./); + for (var attr in attrMap) { + scope.$watch(function() {return element.attr(attr)}, function(value, oldValue) { var parent = scope; + var tokens = attrMap[attr].split(/\./); for (var i = 0; i < tokens.length - 1; i++) { if (typeof (parent[tokens[i]]) == 'undefined') { parent[tokens[i]] = {}; } parent = parent[tokens[i]]; } - // console.log(tokens[tokens.length - 1] + " " + value); parent[tokens[tokens.length - 1]] = value; - } - }); + }); + } } }; } |