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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:45:10+00:00 2026-06-12T13:45:10+00:00

I have a very dynamic site, that uses custom applications/widgets within the page and

  • 0

I have a very dynamic site, that uses custom applications/widgets within the page and I was researching how I might improve the site with the help of Knockout.

  • db <-namespace
    • tabs[] -> tab
      • id
      • title
      • type
      • items[] -> widget
        • id
        • css
        • privy
        • widget-specific viewModel
    • service

If each ‘widget’ is a viewModel that exist within the same tab(div), what kind of issues would I come across?

Is it ok to have one viewModel that starts at the top and contains other models? or should I have individual models and just use ko.applyBindings(vm, element) to apply them?

  • 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-12T13:45:11+00:00Added an answer on June 12, 2026 at 1:45 pm

    We’ve had success both ways, but typically we’ll use the first scenario you mentioned, with one overall parent viewmodel containing instances of other, more specific, viewmodels. General practice suggests to avoid calling applyBindings frequently. A quick mention of knockout’s ‘with’ binding seems appropriate in your instance: http://knockoutjs.com/documentation/with-binding.html

    That would keep the binding expressions within your tabs more focused to the viewmodels that they’re representing:

    <script type="text/javascript">
        var ParentViewModel = function(){
            this.tabOneViewModel = new TabOneViewModel();
            this.tabTwoViewModel = new TabTwoViewModel();
        }
        var TabOneViewModel = function(){
            this.tabOneTitle = 'Tab One';
        }
        var TabTwoViewModel = function(){
            this.tabTwoTitle = 'Tab Two';
        }
        $(function(){
            var parentViewModel = new ParentViewModel();
            ko.applyBindings(parentViewModel,$('#main')[0]);
        });
    </script>
    <body>
        <div id="main">
            <div data-bind="with:tabOneViewModel">
                <div data-bind="text:tabOneTitle"></div>
            </div>
            <div data-bind="with:tabTwoViewModel">
                <div data-bind="text:tabTwoTitle"></div>
            </div>
        </div>
    </body>
    

    Ultimately it’s entirely up to you how you’d like to structure your dom and view models, just laying out a common example we’ve found useful.

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

Sidebar

Related Questions

I have a very dynamic (social networking) site running smarty that I want to
We have a very dynamic site which uses session storage extensively to keep track
We're building a site that will have very minimal code, it's mostly just going
I have come to the conclusion that the very nifty ASP.NET Dynamic Data framework
I am going to build a site that have dynamic content (properties as title,
i have very serious problem if any tech expert can help...thank you in advance..
I have very very big html page/data. I need to fetch data under h1
I have very long integer sequences that look like this (arbitrary length!): 0000000001110002220033333 Now
I have a slight problem with .htaccess redirect. I have a dynamic site with
I have a website in which the total dynamic content is very small (say

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.