afterRender usage question

26 views
Skip to first unread message

Cameron Macintosh

unread,
Jan 12, 2017, 12:52:14 PM1/12/17
to KnockoutJS
I'm trying to use the afterRender attribute on a template binding to swap out the contents of a DOM node based on the context of where I'm including the template.  the HTML chunk I'm swapping in has a computed() property bound, but it's not getting rendered.  Is there a way to trigger my data bindings to be executed in this context or am I completely abusing and misusing afterRender?

Or am I trying to be too clever for my own good when I should just make 2 separate templates? (which is what I'm strongly considering doing right now.)

Thanks in advance.

noirabys

unread,
Jan 13, 2017, 1:56:45 AM1/13/17
to KnockoutJS
hi,
for me its not clear what you would like to do. Please setup an fiddle/example
you may pass in model values to the template 
an handle dom-structure relevant stuff with if or visible foreach what ever binding.
consider the view as slave to the model.

best regards
  noirabys
Reply all
Reply to author
Forward
0 new messages