diff options
| author | Misko Hevery | 2010-05-10 10:36:06 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-05-10 10:36:06 -0700 |
| commit | f5027cc375cf29d8a78679297d9f6bdca9567eb7 (patch) | |
| tree | f415af2b615656562c1d1ac10fe9b4aab83b54c7 /src/Compiler.js | |
| parent | 4542716370ac52f385795f509436104a2a3501d2 (diff) | |
| parent | 664f1c56876f00b885272c39f759641271eef1dc (diff) | |
| download | angular.js-f5027cc375cf29d8a78679297d9f6bdca9567eb7.tar.bz2 | |
Merge branch 'master' of github.com:angular/angular.js
Diffstat (limited to 'src/Compiler.js')
| -rw-r--r-- | src/Compiler.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Compiler.js b/src/Compiler.js index c77c6b30..c8910c27 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -77,7 +77,18 @@ function Compiler(textMarkup, attrMarkup, directives, widgets){ Compiler.prototype = { compile: function(rawElement) { rawElement = jqLite(rawElement); - var template = this.templatize(rawElement, 0, 0) || new Template(); + var index = 0, + template, + parent = rawElement.parent(); + if (parent && parent[0]) { + parent = parent[0]; + for(var i = 0; i < parent.childNodes.length; i++) { + if (parent.childNodes[i] == rawElement[0]) { + index = i; + } + } + } + template = this.templatize(rawElement, index, 0) || new Template(); return function(element, parentScope){ element = jqLite(element); var scope = parentScope && parentScope.$eval ? |
