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 6136639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:37:40+00:00 2026-05-23T17:37:40+00:00

I have a main ViewModel and my view which is great, and I have

  • 0

I have a main ViewModel and my view which is great, and I have a modal window (fancybox) with some quite complex flow (as you will go through 3 steps within that model).

Now I have created a new ViewModel for that, rather than taint the main ViewModel with its concerns. So lets call them MainViewModel, ModalViewModel respectively.

I was originally going to inject the modal views into the main view via some templates, and just get the fancybox to take them as contents. However this way I will be having duplicated dom elements, which could be dangerous as there may then be duplicated element Ids etc.

So I thought maybe I should just try and find a way to use ajax to inject the templates into the fancybox window.

Just to summarise the flow:

  1. User enters main view
  2. User clicks link which spawns modal window
  3. User fills out form in modal
  4. User clicks submission in modal
  5. User enters second stage of modal form
  6. User fills out form 2 in modal
  7. User submits form
  8. User is sent to new page

So am I going about this the right way? Or should I be including the ModalViewModel within the MainViewModel as a child viewModel and dealing with it that way?

  • 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-05-23T17:37:40+00:00Added an answer on May 23, 2026 at 5:37 pm

    Since you have control over naming the ids of the templates, why not just rename the template ids to be unique.

    And as far as binding to the ModalViewModel you could have a ViewModel like this:

    var MainViewModel = {
      //other props
      Modal : new ModalViewModel()
    };
    

    and then applybindings to the childViewModel
    like so:

    ko.applyBindings(MainViewModel.Modal);
    

    if the whole modal view isn’t just a template then use the overload of:

    ko.applyBindings(MainViewModel.Modal,modalRootElement);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have main window which has inner grid components. When I press a button
I have a main page which uses a ViewModel I have created: public class
looking for a bit of Ajax help here... I have quite a complex view
I am using WPF with model-view-viewmodel pattern. I have a ResultsView and ResultsViewModel which
i have main activity in which i have Four menus. and i have one
Hi I have a mainView window which has its dataContext set to it's own
I have a shell which looks like toolbar and defines my main region (a
I hava a main view, where you have one object and you can change
I have WPF application with one main window . In this window there are
I have a silverlight mvvm application that loads main view with 2 user controls

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.