diff options
| author | Misko Hevery | 2013-05-24 12:41:38 -0700 |
|---|---|---|
| committer | Misko Hevery | 2013-05-28 22:28:32 -0700 |
| commit | e46100f7097d9a8f174bdb9e15d4c6098395c3f2 (patch) | |
| tree | 781564141fc9cf580886201d97f7d45064218d82 /src/ng/animator.js | |
| parent | b8ea7f6aba2e675b85826b0bee1f21ddd7b866a5 (diff) | |
| download | angular.js-e46100f7097d9a8f174bdb9e15d4c6098395c3f2.tar.bz2 | |
feat($compile): support multi-element directive
By appending directive-start and directive-end to a
directive it is now possible to have the directive
act on a group of elements.
It is now possible to iterate over multiple elements like so:
<table>
<tr ng-repeat-start="item in list">I get repeated</tr>
<tr ng-repeat-end>I also get repeated</tr>
</table>
Diffstat (limited to 'src/ng/animator.js')
| -rw-r--r-- | src/ng/animator.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ng/animator.js b/src/ng/animator.js index 2965717b..2b399813 100644 --- a/src/ng/animator.js +++ b/src/ng/animator.js @@ -395,11 +395,16 @@ var $AnimatorProvider = function() { } function insert(element, parent, after) { - if (after) { - after.after(element); - } else { - parent.append(element); - } + var afterNode = after && after[after.length - 1]; + var parentNode = parent && parent[0] || afterNode && afterNode.parentNode; + var afterNextSibling = afterNode && afterNode.nextSibling; + forEach(element, function(node) { + if (afterNextSibling) { + parentNode.insertBefore(node, afterNextSibling); + } else { + parentNode.appendChild(node); + } + }); } function remove(element) { |
