jquery - How to use the binding context for knockout js for partial pages in asp.net mvc -
I am new to Now in two partial pages I have defined two binding related visual models. And I'm implementing binding on two watch pages. Tab id element such as in user page And in the settings page, I have defined But there is only one It appears that immediately after applying bindings in the "user" div, Clean the binding when applying them. I have not seen any reference to the settings viewmodel in your code, I am sure that this is also part of the problem. knockoutjs using custom assumptions to make assumptions for my text box Want to But
knockout js
viewloadel is not defined. In my process I have a page named
MyProfile
MyProfile will have two tabs in the page and each tab will have a partial page. I have defined partial pages in this way.
@ MyApplication.Services.ViewModels @model MyProfileViewModel & lt; Div class = "new-tabs" & gt; & Lt; Ul class = "nav nav-tabs" & gt; & Lt; Li class = "active" & gt; & Lt; span id = "# personalalsettings" & gt; Contact information & lt; / Span & gt; & Lt; / li & gt; & Lt; Li & gt; & Lt; Span href = "#settings" & gt; Settings & lt; / Span & gt; & Lt; / li & gt; & Lt; / Ul & gt; & Lt; Div id = "user" & gt; & Lt; Div class = "row" & gt; @ {Html.RenderPartial ("~ / visual / user / _UserDetails.cshtml", Model.userViewModel); } & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div id = "settings" & gt; & Lt; Div & gt; @ {Html.RenderPartial ("~ / scene / user / _UserSettings.cshtml", Model.userSettingsViewModel); } & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;
ko.cleanNode (document.getElementById ("user")); Ko.applyBindings (userViewModel, document.getElementById ("user"));
like .callionnode (document.getElementById ("settings");); Ko.applyBindings (userViewModel, document.getElementById ("settings"));
viewmodel values in the source but the other
visual model is not defined. How can I solve this issue. I hope you understand my question if I get values in the other
viewModel , then I can also make validation.
ko.cleanNode (document.getElementById ("user")); // - Try "settings" instead of "user" bins (user viewmodel, document.getElementById ("settings")); // - It seems that you are applying userviewmodel to settings div
Comments
Post a Comment