Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:18:48+00:00 2026-06-15T14:18:48+00:00

I’ve Made several knockout ViewModels and now i’m trying to bind them to one

  • 0

I’ve Made several knockout ViewModels and now i’m trying to bind them to one ViewModel, but this doesn’t work correctly!

It should work like a navigation. If the LoginModel is done it should skip to the start Model!

I have no idea how this could be made

How to do this?

<!-- Login Seite -->
<form data-bind="visible: userNotLoggedIn" action="" data-role="page" id="Login">

    //Some code

</form>
<!-- ----------------------------------  -->


<!-- Start Seite -->

<form data-bind="visible: showStart" action="" data-role="page" id="pageStart">

   //Some Code

</form>

<!-- --------------------------------------------------------------------- -->



<!-- Projekt Details-->
<form data-bind="visible: showDetails" action="" data-role="page" id="pageDetails">

   // SOME CODE

</form>
</body>
<script type="text/javascript">
    $('#Login').live('pageinit', function (event) {
        ko.applyBindings(new LoginViewModel(), document.getElementById('Login'));
    });

    $('#pageStart').live('pageinit', function (event) {
    alert("Hallo");
        ko.applyBindings(new StartViewModel(), document.getElementById('pageStart'));
    });

    $('#pageDetails').live('pageinit', function (event) {
        alert("Hallo");
        ko.applyBindings(new DetailsViewModel(),document.getElementById('pageDetails'));
    });

</script>
Javascript for Knockout ViewModels:

function LoginViewModel() { //Some Code }

function StartViewModel() { //Some Code }

function DetailsViewModel() { //Some Code}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:18:49+00:00Added an answer on June 15, 2026 at 2:18 pm

    If I have understood your question correctly you are trying to split a page into three interchangeable view models – Login, Start, Detail.

    This could be easily done by grouping them into one master view model. And placing each part in a annonymous template (or knockout ‘if’ comment blocks).

    var masterViewModel = {
        loginVM: ko.observable(),
        detailsVM: ko.observable()
    };
    
    var LoginVM = function () {
        this.showDetails = function () {
            masterViewModel.loginVM(null);
            masterViewModel.detailsVM(new DetailsVM());
        };
    };
    
    var DetailsVM = function () {
        this.showLogin = function () {
            masterViewModel.loginVM(new LoginVM());
            masterViewModel.detailsVM(null);
        };
    };
    
    masterViewModel.loginVM(new LoginVM()); 
    
    ko.applyBindings(masterViewModel);​
    
    <!-- ko template: { 'if': loginVM, data: loginVM } -->  
        <h1>This is the login</h1>  
        <button data-bind="click: showDetails">Show Details</button>  
    <!-- /ko -->
    
    <!-- ko template: { 'if': detailsVM, data: detailsVM } -->  
        <h1>These are the details</h1>  
        <button data-bind="click: showLogin">Show Login</button>  
    <!-- /ko -->  
    

    Here is a complete sample in a jsfiddle – http://jsfiddle.net/angelyordanov/edT79/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.