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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:39:54+00:00 2026-06-04T15:39:54+00:00

From the Ember.js documentation : Person = Ember.Object.extend({ // [..] }); It’s the first

  • 0

From the Ember.js documentation:

Person = Ember.Object.extend({
   // [..]
});

It’s the first definition of Person, so why is the var statement omitted?


var is also missing in some other places, e.g. Ember.Application.Create or Ember.StateManager.Create.


Guys, I know what happens when var is omitted. But there doesn’t seem to be a good reason to do it, like this it’s just confusing people.

  • 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-04T15:39:55+00:00Added an answer on June 4, 2026 at 3:39 pm

    It’s declared globally so Ember and Handlebars can resolve bindings.

    In case of a view for example it’s necessary so it can be instantiated in a Handlebars template via the view helper:

    Handlebars:

    <script type="text/x-handlebars" >
        {{#view MyView}}
             my view's template
        {{/view}}
    </script>
    

    JavaScript:​

    MyView = Ember.View.extend({});
    

    The following example doesn’t work when the controller is declared with a var statement, see http://jsfiddle.net/pangratz666/uzsd6/:

    Handlebars:

    <script type="text/x-handlebars" >
        {{controller.name}} - {{secondController.name}}
    </script>​
    

    JavaScript:

    var controller = Ember.Object.create({
        name: 'my name'
    });
    
    var secondController = Ember.Object.create({
        nameBinding: 'controller.name'
    });​
    

    If the controllers are declared on a global available object, the App namespace in this case, the the bindings can be resolved, see http://jsfiddle.net/pangratz666/kUmje/:

    Handlebars:

    <script type="text/x-handlebars" >
        {{App.controller.name}} - {{App.secondController.name}}
    </script>​
    

    JavaScript:

    App = Ember.Application.create({});
    
    App.controller = Ember.Object.create({
        name: 'my name'
    });
    
    App.secondController = Ember.Object.create({
        nameBinding: 'App.controller.name'
    });​
    

    You should take a look at the Emberist ‘s blog about Naming Conventions in Ember.js.

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

Sidebar

Related Questions

here is some documentation generated from activeX, can you explain me what do those
I am new to Ember and attempting to learn parts of it from the
The Code is from the ember.js official introduction: <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01
From all the various examples of Ember.js, I have not been able to figure
I pulled the latest source from github. I'm trying to build: stephan@E6520:~/dev/ember.js$ rake rake
I'm not clear on what the following means (from the Git submodule update documentation):
I had selected sproutcore as a framework right before Ember forked from sproutcore. I
I am using Ember.js to create a table from a json feed. I have
I have an Ember.Button which should remove an element from an array. The button
iwant to get the video url from a object/embed html source. i read i

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.