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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:57:58+00:00 2026-06-15T00:57:58+00:00

uhh it’s hard to come with a right title for this problem excuse me.

  • 0

uhh it’s hard to come with a right title for this problem excuse me.

In a backbone.js application i am building. Models, Views, Templates are all in separate javascript, html files. I want to export the Models, Views and Templates to the application bootstapper file (app.js) without polluting the global variable i.e doing window.App.Model = myModel; that. By export i mean make the code inside the files available to app.js for initialization and running

  1. How do i go about doing this?

  2. Are there any patterns that will solve the problem? Could you provide me a example

Description

In cases where models,views and templates are split to many disparate files the application bootstrapper file app.js should have some means to access these M,V,C components. Hence common approach is to do below inside the model.js file

window.App.Model.PersonModel = Backbone.Model.extend({});

App.js

var instance = new window.App.Model.PersonModel();
var personView = new window.App.Views.PersonView({model:instance});

Finally you see that everything derives from the Global object App which i think is not safe, improper and weak way to build application dependencies

Suggestions

Just to the above question, could someone suggest a template loading library(javascript templates regardless of engine used) that can be used to load the templates

  • 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-15T00:58:00+00:00Added an answer on June 15, 2026 at 12:58 am

    Take a look on RequireJS, which support asynchronous module definitions/loading. You would have to rewrite your modules to and app.js to satisfy AMD api, but it would take only few strings of code.

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

Sidebar

Related Questions

Uhh Sorry its really hard to explain but. This is already a string: login_username=Username&login_password=Password&login_submit=Submit
I'm sorry if this is a Uhh RTFM type of question, but I've checked
I created some buttons in Code like this. if (infoLoader.categoriesLoaded) { sideBarButtons = new
I'm trying to launch embedded Youtube videos from a UIWebView, but get this error
I'm working on an application that allows dentists to capture information about certain clinical
i was looking how to inject a dll into a program (exe, or dll,
I ran across some very interesting code that makes me wonder about what bool
My app has a GtkFileChooserButton that you can use to open a chooser widget
I am currently integrating an open source chat (AJAX Chat) into another project. Now,
(GridWorld as in Collegeboard's AP exam case study thing) So, I've been working on

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.