aboutsummaryrefslogtreecommitdiffstats
path: root/src/Compiler.js
diff options
context:
space:
mode:
authorMisko Hevery2010-05-10 10:36:06 -0700
committerMisko Hevery2010-05-10 10:36:06 -0700
commitf5027cc375cf29d8a78679297d9f6bdca9567eb7 (patch)
treef415af2b615656562c1d1ac10fe9b4aab83b54c7 /src/Compiler.js
parent4542716370ac52f385795f509436104a2a3501d2 (diff)
parent664f1c56876f00b885272c39f759641271eef1dc (diff)
downloadangular.js-f5027cc375cf29d8a78679297d9f6bdca9567eb7.tar.bz2
Merge branch 'master' of github.com:angular/angular.js
Diffstat (limited to 'src/Compiler.js')
-rw-r--r--src/Compiler.js13
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 ?