I just want to make sure i'm not doing anything wrong. This seems to work fine.
So in my html/javascript spa (no mvc), I've got what's like a master page, loading content from an HTML file on each menu click. Is it ok to bind a viewmodel under another div that has a binded view model? I just want to make sure. You guys should set up a SPA example with this type of format, with a menu loading different content.
Here's the Home, About is similar
So in my html/javascript spa (no mvc), I've got what's like a master page, loading content from an HTML file on each menu click. Is it ok to bind a viewmodel under another div that has a binded view model? I just want to make sure. You guys should set up a SPA example with this type of format, with a menu loading different content.
<div id=
"divMaster"
>
Kendo Menu Here With clicks to fill content...
<div id=
"divContent"
></div>
</div>
<script>
$(document).ready(function () {
kendo.bind(divMaster, app.masterService.viewModel);
}
</script>
function
clickAbout() {
$(
'#divContent'
).load(
'/Content/About.html #about'
);
location.hash =
"#about"
;
}
function
clickHome() {
$(
'#divContent'
).load(
'/Content/Home.html #home'
);
location.hash =
"#home"
;
Here's the Home, About is similar
<script src=
"/scripts/home.viewmodel.js"
></script>
<script>
$(document).ready(
function
() {
var
divHome = $(
"#divHome"
);
kendo.bind(divHome, app.homeService.viewModel);
});
</script>
<div id=
"divHome"
>
Home Page
<br />
<input id=
"txtHomelbl"
data-bind=
"value: testText"
/>
</div>