Skip to content

Commit

Permalink
transclude the element in recursive directive
Browse files Browse the repository at this point in the history
Before, we were transcluding only the contents. This seemed to do
nasty things with Angular's scoping.

Could be related to angular/angular.js#1313
  • Loading branch information
tilgovi committed Dec 15, 2012
1 parent d3d2bb6 commit d1a7d34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions h/js/directives.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ annotation = ['$filter', ($filter) ->


recursive = ['$compile', ($compile) ->
compile: (tElement, tAttrs) ->
linkRec = $compile tElement.contents().remove(), (scope, cloneAttachFn) ->
linkRec scope, cloneAttachFn
compile: (tElement, tAttrs, transclude) ->
transclude = $compile tElement, (scope, cloneAttachFn) ->
transclude scope, cloneAttachFn
, 1000
post: (scope, iElement, iAttrs, controller) ->
linkRec scope, (contents) -> iElement.append contents
transclude scope, (el) -> iElement.replaceWith el
priority: 1000
restrict: 'A'
terminal: true
]


Expand Down
4 changes: 2 additions & 2 deletions h/templates/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<div class="paper excerpt">
<blockquote data-ng-bind="thread.message.annotation.quote" />
</div>
<div data-recursive="" class="paper">
<div class="paper">
<!-- Thread view -->
<div class="thread">
<div data-recursive="" class="thread">
<!-- Annotation -->
<div data-ng-model="thread.message.annotation"
class="detail annotation" />
Expand Down

0 comments on commit d1a7d34

Please sign in to comment.