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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:27:00+00:00 2026-06-08T11:27:00+00:00

In a backbone application what is the best practice regarding when a model is

  • 0

In a backbone application what is the best practice regarding when a model is fetched? I can see the following possibilities.

  • View calls the model fetch method
  • Some other JavaScript code calls the fetch model? if so when and what structure would this code have? is this the missing controller concept in Backbone?
  • 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-08T11:27:01+00:00Added an answer on June 8, 2026 at 11:27 am

    A few best practives:

    1 Collections and models that are necessary from the very first milliseconds of the app’s life should be ‘bootstrapped’ in place (so there shouldn’t be need to fetch them to gain access to vital data)

    So when the user is served the correct pages from the server, the models and collections should be already in place (nice example from backbone.js docs)

     var ExampleCollection = new Backbone.Collection();
     ExampleCollection.reset(<%= @your_collection_data.to_json() %>); // Or whatever your server-side language requires you to do, this is a ruby example
    

    2 The rest can be fetched just in time

    The models and collections that aren’t needed at the moment your app is initialized can be fetched whenever you feel like it, but I think that the logical time to do that is when the user expresses intent to use those models. E.g. user presses a button to open a view that needs some model/collection -> fetch that collection, user wants to clear unsaved changes from a model -> fetch that model from the server to get the last saved status of the model, and so forth. Usually the place where the fetching is bound to happen is the view that ‘owns’ the model/collection, because it relays the users actions to the model and displays the model’s state to the user.

    But like it was said, Backbone.js isn’t strict about when a model or collection should be fetched. It can be done anywhere in the app, just make sure you do it only when it’s necessary.

    Hope this helps!

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

Sidebar

Related Questions

In my Backbone application I have a main view that shows previews of posts.
I'm trying to set up a Backbone application. This code below gives to following
I have a backbone application which, upon load, needs to fetch data from four
What is the best way to bind events to a Backbone boilerplate application? I've
I'm building a Backbone application and I'm observing some behaviour I can't place. Consider
I am trying to create a Task application with Backbone.Js. Task is a model
I've developed a nice rich application interface using Backbone.js where users can add objects
If I am building an application with backbone.js, what is the best tool or
How can I create a subrouter for my backbone application? I have found some
My current backbone application has a url: localhost/#users Is there a way to access

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.