我有一个视图 xyz.cshtml
我在其中渲染了两个局部视图a
和b
. 现在在 xyz.cshtml
页面中我有一个按钮来切换视图。但是当我更改视图时出现问题,它不会对新加载的视图应用绑定。
提前致谢 。
我有一个视图 xyz.cshtml
我在其中渲染了两个局部视图a
和b
. 现在在 xyz.cshtml
页面中我有一个按钮来切换视图。但是当我更改视图时出现问题,它不会对新加载的视图应用绑定。
提前致谢 。
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.