Last post Oct 21, 2013 05:42 AM by xinqiu
Oct 21, 2013 05:36 AM|jornathan.le|LINK
I am a newbie in SPA. I need to know about navigation in SPA. I am confused about that when I read code SPA template. I want a really code sample for this case:
- I have two partical page Home.cshtml and About.cshtml
- I have master page default Layout.cshtml
- I have Home.cshtml with <input
data-bind="value: firstName" /> <input id="Next" data-bind="click: navigateAbout" /> and script get model from API for binding to here by Ko.applyBinding
- I have About.cshtml with <input data-bind="value: aboutName" /> and script get model from API for binding to here by Ko.applyBinding
So how I can navigate from Home to About by updated html in @RenderBody() in Layout.cshtml by clicking button "Next" with navigateAbout() function and execute AboutViewModel script when navigate success ? How I can use Sammy.js or Path.js to store hash
URL #about to navigate About.cshtml when enter in Browser URL ?
Oct 21, 2013 05:42 AM|xinqiu|LINK
SPA navigation is really template browsing within a client page.
home.cshtml/about.cshtml are both server side pages, they are part of MVC4/5, and can only be navigated through postbacks.
Checkout hottowel SPA template to see how it is used to do navigation.