Pergunta

I have a View xyz.cshtml

in which i render two partial views a and b . Now in xyz.cshtml page i have a button to switch view . But problems comes when i change view it doesn't apply binding on newly loaded view .

Thanks in advance .

Foi útil?

Solução

If you load the partial views dynamically (I mean if they aren't both loaded on page load, but instead requested on button click) then Knockout will have 0 knowledge of those bindings.

Off the top of my head I would basically have two view models and when you click the button and a new partial view is loaded in run ko.applyBindings on the loaded in markup.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top