diff options
| author | Misko Hevery | 2011-02-07 15:29:56 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-02-16 00:49:15 -0500 |
| commit | 23b255a8b7481ff5c06004b3558c07f981c42276 (patch) | |
| tree | 57e612f658c9f8903d93a28e9095590178e2ce3a /src/Compiler.js | |
| parent | e2154cbc0b9265bea04ce328879d4e9bf1c67c51 (diff) | |
| download | angular.js-23b255a8b7481ff5c06004b3558c07f981c42276.tar.bz2 | |
remove $init on scope from applying compilation template
Closes #40
Diffstat (limited to 'src/Compiler.js')
| -rw-r--r-- | src/Compiler.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/Compiler.js b/src/Compiler.js index 804a9622..6aee40b8 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -13,7 +13,7 @@ function Template(priority) { } Template.prototype = { - init: function(element, scope) { + attach: function(element, scope) { var inits = {}; this.collectInits(element, inits, scope); forEachSorted(inits, function(queue){ @@ -96,18 +96,14 @@ Compiler.prototype = { template = this.templatize(element, index, 0) || new Template(); return function(element, parentScope){ element = jqLite(element); - var scope = parentScope && parentScope.$eval ? - parentScope : createScope(parentScope); + var scope = parentScope && parentScope.$eval + ? parentScope + : createScope(parentScope); element.data($$scope, scope); - return extend(scope, { - $element:element, - $init: function() { - template.init(element, scope); - scope.$eval(); - delete scope.$init; - return scope; - } - }); + template.attach(element, scope); + scope.$element = element; + scope.$eval(); + return scope; }; }, |
