Knockoutjs reapply bindings

664 views
Skip to first unread message

Weekends

unread,
Feb 24, 2011, 2:48:59 PM2/24/11
to knock...@googlegroups.com
Hello, I remember this coming up a while back but bec of the ~new Google Groups I can't seem to find the old thread.

Regarding: Knockoutjs reapply bindings

Is this something that was added into KnockoutJS or somehow supported?


Use Case Being: I render a page and apply the bindings. Then a user submits a comment which results in jQuery injecting a DIV with a data-binding inside. I'm noticing the data-binding in the injected DIV is not being noticed by KnockoutJS and I would really like for it to be noticed :)

Thoughts? ... I could eventually move comments into a KnockoutJS model, but that's a much larger effort that I'd like to solve after I solve for attachments if at all possible.

Thank you!

rpn

unread,
Feb 25, 2011, 10:40:45 PM2/25/11
to knock...@googlegroups.com
I had not done this before, but it looks like you can use ko.applyBindingsToNode to handle this case.  

Sample here:

Not sure if that works for your case.
Reply all
Reply to author
Forward
0 new messages