Why cant define the objects starts with App. using var?


#1
App.PostsRoute=Ember.Route.extend({
   model:function(){
      return App.Comments;
   }
});

var App.Comments=[
{

},
{

}];

In the above code, model doesn’t recognize App.Comments. But if i remove var then its working. why is it so ?


#2

Remove var before App.Comments. ( you’re not defining a new variable, you’re setting a property on App object )