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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:39:07+00:00 2026-06-09T21:39:07+00:00

Looking at some backbonejs examples on codeschoo.com, I don’t see any explicit associations between

  • 0

Looking at some backbonejs examples on codeschoo.com, I don’t see any explicit associations between views and their models. How does a view know what model it should be associated with? Is it by convention, e.g. TodoView assumes that this.model is of type Todo?

To explicitly set the model to the view, is it just a matter of passing in the model in the constructor?

  • 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-09T21:39:08+00:00Added an answer on June 9, 2026 at 9:39 pm

    If you pass a model property to a view constructor, it will set that directly as a property of the view instance, e.g. view.model. That’s the case for a select group of other properties as well. Beyond those, properties passed to view constructors are set in view.options.

    So yes, you can do this:

    var view = new Backbone.View( {
    
      model : new Backbone.Model
    
    } );
    

    Or change a an existing view instance’s model any time by assigning to model:

    view.model = new Backbone.Model;
    

    Some people set references to views in models (e.g. model.view), but so far I’ve avoided that.

    http://backbonejs.org/#View-constructor

    When creating a new View, the options you pass are attached to the view as this.options…There are several special options that, if passed, will be attached directly to the view: model, collection, el, id, className, tagName and attributes.

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

Sidebar

Related Questions

Looking at some sample javascript code at http://alexgorbatchev.com/SyntaxHighlighter/manual/api/autoloader.html I see: <script src=shCore.js type=text/javascript></script> <script
Looking at some assembly code for x86_64 on my Mac, I see the following
Looking at some of the code System.Linq I've come across some examples of Buffer<TSource>
Looking some frameworks like Code Igniter I see they use a defined check on
I'm looking for some sort of framework to act as a middle-layer between the
Looking at some code I'm maintaining in System Verilog I see some signals that
I've been looking at some examples of backbone.js based application. I notice that in
Looking for some black magic that will match any string with weird characters in
I'm fiddling with a bit of c++/opencv. I was looking some of the samples
Looking for some advice on the best way to implement localization along with client

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.