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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:57:01+00:00 2026-06-09T18:57:01+00:00

I’m experimenting with routing in ember at the moment, and have a working example.

  • 0

I’m experimenting with routing in ember at the moment, and have a working example. The problem is, I’m a bit confused WHY it works. Currently this route just has 2 simple views. Here is the code:

App = Em.Application.create();

App.Router = Ember.Router.extend({
  root: Ember.Route.extend({

    index: Ember.Route.extend({
      route: '/',
      redirectsTo: 'home' //when hitting the base URL, redirect to home
    }),
    home: Ember.Route.extend({
      route: '/home', 
      connectOutlets: function(router) {
        router.get('applicationController').connectOutlet('home'); 
      }
    }),
    about: Ember.Route.extend({
      route: '/about',
      connectOutlets: function(router) {
        router.get('applicationController').connectOutlet('about'); 
      }
    })
  })
});


//Main controller + view
App.ApplicationController = Ember.Controller.extend({});

App.ApplicationView = Ember.View.extend({ 
    templateName: 'application',
    goHome: function(){
        App.router.transitionTo('home'); 
    },
    goAbout: function(){
        App.router.transitionTo('about');
    }
});


// Home page
App.HomeView = Ember.View.extend({
    templateName: 'home'
})


// About page
App.AboutController = Ember.Controller.extend({
    numWidgets: 45
})

App.AboutView = Ember.View.extend({
    numWidgetsBinding: 'App.aboutController.numWidgets',
    templateName: 'about'
})


App.initialize();

In my HTML I just have a couple of really simple templates with the names “application”, “home” and “about”.

So, it all works, and looks very similar to all the examples floating about on the net. Great! But I’m confused about how it seems I have several things instantiated for me, without me asking to do it. Is this correct?

For example:

How is it creating an instance of ApplicationController?

In the connectOutlets functions, it’s looking for a controller called “applicationController”. I never created anything called “applicationController” (with lower-case “a”), I just extended a controller and called it “ApplicationController” (with a capital “A”). Why does this work?

How is it creating an instance of AboutController?

I did a simple test binding between the “about” page view and controller. In the view, I am binding with the variable ‘App.aboutController.numWidgets’. I never called App.AboutController.create(). So how is there an instance of this ready for me to talk to? Again, it has a lower case letter (“aboutController”). All I ever did was extend a controller (and named it with a capital letter – “AboutController”)

A little explanation would be great, as like any normal developer, I feel that using code where you dont know why it’s working is crazy!

  • 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-09T18:57:03+00:00Added an answer on June 9, 2026 at 6:57 pm

    App.initialize(); does all the instantiation and injection stuff :), based on strong naming conventions: Ember naming / capitalization convention. When you call xxxController.connectOutlet(options), the option has is also conventional, see Confusion about naming conventions in emberjs

    Hope that helps.

    EDIT: With the latest master, you don’t have to call App.initialize() manually. The application is auto-initialized when all is ready 🙂

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

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.