I do it in a way similar to how Sander suggested. The template for my
comment directive includes a reply form hidden behind an ng-if. That way it
appears and disappears appropriately from the DOM (ng-if doesn't compile or
inject nodes until its watch value is true), but the template for the reply
form is indeed all over the place. The reply bit is always in the same
place, relative to the comment it is a reply to. Then I just put a similar
area at the top and bottom of the ng-repeat that displays the comment
thread.

Because the comment thread is displayed as an ng-repeat over post.comments,
my controller just adds the comment to the end of post.comments on a
successful $http.put (it actually does it optimistically as the user hits
submit, and will pull it off and display an error on the .catch handler for
the promise stack, rather than wait for the http to finish before updating
the view).


On Thu Nov 13 2014 at 6:34:00 AM Florian Krämer <
[email protected]> wrote:

> Thanks for your answer Sander, yes a little.
>
> My main problem is how to inject something in a different place and
> multiple times. So when I click the reply link / button I want to inject
> the reply form after that comment in a certain place in the DOM, not right
> after the button. The same applies when I want to inject the successfully
> submitted comment.
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to