문제

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 .

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top