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

  • Home
  • SEARCH
  • 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 8813919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:58:52+00:00 2026-06-14T03:58:52+00:00

This Emberjs router refuses to work with jsfiddle Jquery onDomReady and returns the error

  • 0

This Emberjs router refuses to work with jsfiddle Jquery onDomReady and returns the error ; Uncaught Error: assertion failed: Could not find state for path: “root”.

However, when i change the jsfiddle jquery settings to onLoad, the page loads but the router still seems unrecognized and any attempt to do a manually transition of the router fails with the message error: Cannot call method ‘transitionTo’ of undefined. But if i click one of the action helpers in the view that points or links to a route, it throws the error.

Any suggestions on how to resolve this will be greatly appreciated.

 App = Ember.Application.create({
   ready: function(){ 
    App.router.transitionTo('root');
    }
 });

 App.stateFlag = Ember.Mixin.create({
   stateFlag: function(name) {
   var state = App.get('router.currentState.name'); 
    while (state.name === name) {
        state = state.get('parentState');
        console.log('state');
        //return true;
    }
 }.property('App.router.currentState')
 });


 App.ApplicationController = Em.Controller.extend();

 App.ApplicationView = Ember.View.extend({
     templateName: 'application'
 });

 App.HomeController = Em.ObjectController.extend();
 App.HomeView = Em.View.extend({
    templateName: 'home'
 });

 App.LoginController = Em.ObjectController.extend();

 App.LoginView = Ember.View.extend({
    tagName: 'form',
    templateName: 'logging',

 });

 App.SectionController = Em.ObjectController.extend(App.stateFlag, {
  stateFlag: 'sectionA',
  stateFlag: 'sectionB'
});

App.SectionView = Ember.View.extend({
 templateName: "sub_section_b_view"
});

App.SectionA = Em.ObjectController.extend();
App.SectionAView = Ember.View.extend({
 templateName: "section A"
});

App.SectionB = Em.ObjectController.extend();
App.SectionBView = Ember.View.extend({
 templateName: "section B"
});

App.Router = Ember.Router.extend({
 enableLogging: true,
 location: 'hash',
 root: Ember.Route.extend({

    anotherWay: Ember.Router.transitionTo('root.logon.index'),

    showLogin: function(router, event) {
        router.transitionTo('root.logon.index');
    },

    doHome: function(router, event) {
    router.transitionTo('home');
  },
    doSections: function(router, event) {
    router.transitionTo('section.index');
  },

    home: Ember.Route.extend({
    route: '/',
    connectOutlets: function(router, event) {
      router.get('applicationController').connectOutlet('home');
    }

  }),

   logon: Ember.Route.extend({
      route: '/login',
      enter: function(router) {
          console.log("The login sub-state was entered.");
        },
      connectOutlets: function(router, context) {
        router.get('applicationController').connectOutlet('mine', 'login');
         router.get('applicationController').connectOutlet('section');
      },

        index: Ember.Route.extend({
            route: '/',
            connectOutlets: function(router) {
                router.get('loginController').connectOutlet('loga', 'login');
            }
        })
   }),

   section: Ember.Route.extend({
       route: '/section',
       connectOutlets: function(router, event) {
         router.get('applicationController').connectOutlet('section');
       },

      index: Ember.Route.extend({
        route: "/"
      }),       

      doSectionA: function(router, event) { router.transitionTo('section.sectionA'); 
      },

      sectionA: Ember.Route.extend({
        route: 'section A',
         connectOutlets: function(router, context) {
            router.get('sectionController').connectOutlet('sectionA'); 
          }

       }),

       doSectionB: function(router, event) { router.transitionTo('section.sectionB');

       },

       sectionB: Ember.Router.extend({
          route:'section B',
        connectOutlets: function(router, context) {
          router.get('sectionController').connectOutlet('sectionB');
        }
      })
    })
})
});​

The handlebar templates

  <script type="text/x-handlebars" data-template-name="application">
    <h1>Hi samu</h1>
    {{outlet loga}}
    {{outlet }}
    <a href="#" {{action showLogin }}> go to root.logon.index state</a>   
    <br>
   <a href="#" {{action anotherWay}} >it works to go to root longon index using this</a>
 </script> 

 <br>
 <script type='text/x-handlebars' data-template-name='home'> 
 </script>
 <br>
 <script type="text/x-handlebars" data-template-name="logging">

   {{view  Ember.TextField placeholder="what" class="userInput"  }}
   {{outlet loga}}
 <br>
 <b> Inserted from Login controller and view </b>

 </script>

 <script type="text/x-handlebars" data-template-name="sub_section_b_view">

   <b>Inserted from the subsection controller and view </b> 

</script>

<script type='x-handlebars' data-template-name='section A' >

</script>


<script type='x-handlebars' data-template-name='section B' >

 </script>
  • 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-14T03:58:53+00:00Added an answer on June 14, 2026 at 3:58 am

    After tinkering about, i go everything working. The named outlet works and the nested sub-route works. Here is the working jsfiddle. In that jsfiddle, if you click, ‘go to root.logon.index state’ if will render the form being provided by the named outlet called {{outlet loga}}.

    If you click the link called testing sections, it will render the section view which displays two link to two sub-sections, click on any of them renders their content. Also i tried to break each of the routes in the Router into many classes or standalone classes and then creating new routes tat extending those classes from inside the Router, to simulate splitting Emberjs Router across many files to reduce the Router size in real life situations and it worked

    Here is the whole code.
    Handlebars template

     <script type="text/x-handlebars" data-template-name="application">
       <h1>Hi Laps</h1>
       {{outlet loga}}
       {{outlet }}
        <a href="#" {{action showLogin }}> go to root.logon.index state</a>   
          <br>
      <a href='#' {{action doSection}}> testing sections</a>
     </script> 
    
     <br>
    
     <script type='text/x-handlebars' data-template-name='home'> 
     </script>
    
     <br>
    <script type="text/x-handlebars" data-template-name="logging">
      {{view  Ember.TextField placeholder="what" class="userInput"  }}
      {{outlet loga}}
      <br>
      <b> Inserted from Login controller and view </b>       
    </script>
    
    <script type="text/x-handlebars" data-template-name="sub_section_b_view">
    
      <b>Inserted from the subsection controller and view </b> 
      <a href='#' {{action doSectionA}}><p>Sub section  yea</p></a>
      <br>
       <a href='#' {{action doSectionB}}> our B part yep</a>
    
       {{outlet}}
    </script>
    
    <script type='text/x-handlebars' data-template-name='sectionA' >
     <br>
     <font color="red">my section a is working</font>
    </script>
    

    Javascript/Emberjs bit

    App = Ember.Application.create({
      ready: function(){ 
      //App.router.transitionTo('root.home');
      }
    });
    
    App.stateFlag = Ember.Mixin.create({
        stateFlag: function(name) {
        var state = App.get('router.currentState.name'); 
        while (state.name === name) {
            state = state.get('parentState');
            console.log('state');
            //return true;
         }
       }.property('App.router.currentState')
    });
    
    
    App.ApplicationController = Em.Controller.extend();
    
    App.ApplicationView = Ember.View.extend({
     templateName: 'application'
    });
    
    App.HomeController = Em.ObjectController.extend();
    App.HomeView = Em.View.extend({
      templateName: 'home'
    });
    
    App.LoginController = Em.ObjectController.extend();
    
    App.LoginView = Ember.View.extend({
     tagName: 'form',
     templateName: 'logging',
     /* class name does not work */
     className: ['userInput']
    });
    
    
    App.SectionController = Em.ObjectController.extend(App.stateFlag, {
      stateFlag: 'sectionB'
    });
    
    App.SectionView = Ember.View.extend({
      templateName: "sub_section_b_view"
    });
    
    App.SectionAController = Em.ObjectController.extend();
    App.SectionAView = Ember.View.extend({
      templateName: "sectionA"
    });
    
    App.SectionBController = Em.ObjectController.extend();
    App.SectionBView = Ember.View.extend({
     templateName: "sectionB"
    });
    
    
    App.SectionARoute = Ember.Route.extend({
      connectOutlets: function(router, context) {
       router.get('sectionController').connectOutlet({viewClass: App.SectionAView}); 
       }                  
    });
    
    App.SectionBRoute = Ember.Route.extend({
     connectOutlets: function(router, context) {
      router.get('sectionController').connectOutlet({viewClass: App.SectionBView});
     }
    });
    
    
    App.Router = Ember.Router.extend({
     enableLogging: true,
     location: 'hash',
     root: Ember.Route.extend({
       anotherWay: Ember.Router.transitionTo('root.logon.index'),
       doSection: Ember.Router.transitionTo('root.section.index'),
    
       showLogin: function(router, event) {       
           router.transitionTo('root.logon.index');
       },
    
       doHome: function(router, event) {
          router.transitionTo('home');
       },
       doSections: function(router, event) {
          router.transitionTo('section.index');
       },
       home: Ember.Route.extend({
          route: '/',
          connectOutlets: function(router) {
          router.get('applicationController').connectOutlet('home');
           }
    
       }),
    
       logon: Ember.Route.extend({
          route: '/login',
          enter: function(router) {
             console.log("The login sub-state was entered.");
          },
    
          index: Ember.Route.extend({
             route: '/',
             connectOutlets: function(router, context) {
                router.get('applicationController').connectOutlet('loga', 'login');
             }
          })
        }),
    
        section: Ember.Route.extend({
            route: '/section',
            doSectionA: Ember.Router.transitionTo('section.sectionA'),
            doSectionB: Ember.Router.transitionTo('root.section.sectionB'),
    
            connectOutlets: function(router, event) {
                    router.get('applicationController').connectOutlet('section');
            },
    
            index: Ember.Route.extend({
                 route:  '/'            
            }),
    
    
             sectionA: App.SectionARoute.extend({
                 route: '/sectionA'
             }),
    
             sectionB: App.SectionBRoute.extend({
                 route: '/sectionB'
             })        
    
       })         
    
     })
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is this a bug in emberjs. this totally empty fiddle: http://jsfiddle.net/s5md8/1/ returns Ember Handlebars
This error is driving me crazy . I tried freenode #emberjs before asking here.
Emberjs core has a new router implementation which extends Ember.StateManager. This is the basic
How to get index item of array in an emberjs view. This returns an
I've noticed that the router in EmberJS refuses to call connectOutlets when you request
I'm getting this JS error while trying to use Ember routing: Uncaught TypeError: Object
This code below allows me to find the word error in all my files
Please see the solution to another question provided by ud3323: http://jsfiddle.net/ud3323/ykL69/ . This solution
I'm creating a router-based EmberJS app (strongly modelled on the excellent router guide ).
I have been going through this post regarding newly added features in EmberJS. One

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.