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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:54:55+00:00 2026-05-28T02:54:55+00:00

Has anyone had much success with RequireJS and Ember.js? Seeing as Ember likes to

  • 0

Has anyone had much success with RequireJS and Ember.js? Seeing as Ember likes to have its structure assigned to a global object I’m finding that it can really butt heads with Requirejs. Would something like LAB.js work better for Ember?

  • 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-28T02:54:56+00:00Added an answer on May 28, 2026 at 2:54 am

    EDIT (2012-01-30): I pushed a more complete example in a repo on bitbucket.

    I have successfully used RequireJS to load Ember.js as well as the datetime addon (github). The Ember namespace itself stays global, but all of my application’s data, including my instance of Ember.Application, is kept within modules through RequireJS. I’m also loading the handlebars templates using the ‘text!’ plugin.

    I haven’t had any issue yet, but this is not a complete application, more of a proof of concept. Here’s how I made it work. I can load my application directly with Safari without the need of a server. You would still need a server to load it with Chrome, which doesn’t let JavaScript load files from the filesystem.

    1) Because Ember.js uses BPM/Spade, I couldn’t use a clone of the repo. Instead I’m wrapping the compiled version within a module:

    lib/ember.js:

    define(['jquery',
            'plugins/order!lib/ember-0.9.3.js',
            'plugins/order!lib/ember-datetime.js'],
             function() {
                 return Ember;
    });
    

    Note that this in itself doesn’t hide Ember from the global scope. But I’m setting things up so that if, in the future, I’m able to do hide it, every other module which depends on this module will still work as-is.

    2) Modules can refer to Ember like so:

    app/core.js:

    define(['lib/ember'], function(Em) {
        MyApp = Em.Application.create({
            VERSION: "0.0.1"
        });
        return MyApp;
    });
    

    Here, “Em” could have been named something else; it doesn’t refer directly to the global variable, but comes from the module defined in lib/ember.js.

    3) To be accessible by Ember, handlebars have to be registered:

    app/templates/my-template.handlebars:

    MyApp v{{MyApp.VERSION}}.
    

    app/views/my-view.js:

    define(['lib/ember',
            'plugins/text!app/templates/my-template.handlebars'],
            function(Em, myTemplateSource) {
    
                Em.TEMPLATES["my-template"] = Em.Handlebars.compile(myTemplateSource);
    
                var myView = Em.View.create({
                    templateName: "my-template";
                });
    
                return myView;
    });
    

    4) I’m using require-jquery.js (jQuery and RequireJS bundled together).

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

Sidebar

Related Questions

Has anyone had much success on Android with creating blurred textures using blending to
Has anyone had success with Dragon Naturally Speaking voice recognition software when it comes
Has anyone had experience with calling a view using EF 4.1 DBContext object? If
Has anyone had any success running two different web servers -- such as Apache
Has anyone had any success with installing Rails 3.2 and JRuby 1.6.5 on Mac
Has anyone had any success setting up Zend_Test? What was your method/approach and how
Has anyone had a go at creating a view that sorts a collection? The
Has anyone had this problem? I deleted a column in the table editor and
Has anyone had any experience in saving app preferences (within app, not in Settings
Has anyone had any experiences developing large Java applications using GNU gettext for internationalization?

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.