diff options
| author | Misko Hevery | 2010-04-30 12:22:07 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-04-30 12:22:07 -0700 |
| commit | ac1d02d0658cb74ae3822e364f84809d78cda335 (patch) | |
| tree | 6c5fdbd670d758d65c4d52f2e261818ac1607f47 /src/Compiler.js | |
| parent | 549ff73a9b66e718383c79ccd7c28e4f9b25632d (diff) | |
| download | angular.js-ac1d02d0658cb74ae3822e364f84809d78cda335.tar.bz2 | |
make xhr post optional
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 ? |
