Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing the new Ember RouterV2, how do you immediately redirect to another state from the index state?
    primarykey
    data
    text
    <p>What I have so far:</p> <pre><code>App = Ember.Application.create({ LOG_TRANSITIONS: true }); App.Router.map(function(match){ match('/').to('application'); match('/edit').to('edit'); }); App.ApplicationRoute = Ember.Route.extend({ redirect: function() { this.transitionTo('edit'); }, events: { startEdit: function( context ){ this.transitionTo( 'edit' ); } } }) App.EditRoute = Ember.Route.extend({ init: function(){ this._super() console.log('EditRoute') }, }); </code></pre> <p>Handlebars:</p> <pre><code>&lt;script type="text/x-handlebars" data-template-name = 'application'&gt; Hello World {{ outlet main }} &lt;/script&gt; &lt;script type="text/x-handlebars" data-template-name = 'edit'&gt; &lt;div class = 'edit-background'&gt; Edit State: {{ title }} &lt;/div&gt; &lt;/script&gt; </code></pre> <p>I have four questions: </p> <ol> <li><p>When I open the application it just remains in the home page, is the redirectTo hook suppose to immediately redirect you to another state?</p></li> <li><p>In addition, I have this events hash in <code>AplicationRoute</code> per suggestion from here: <a href="https://stackoverflow.com/questions/14186092/how-to-programmatically-transition-between-routes-using-ember-js-new-router">How to programmatically transition between routes using Ember.js&#39; new Router</a>. but I read through the answers and still am not sure how you are supposed to use it.</p></li> <li><p>How do I test the router on the console? before you could navigate between the states by calling <code>transitionTo</code> commands, what do I do now?</p></li> <li><p>For some odd reason, my application template seem to rendered twice, as in there are two 'Hello World' up there, and when try to add something like: <code>&lt;li&gt;{{#linkTo edit}}edit{{/linkTo}}&lt;/li&gt;</code></p></li> </ol> <p>I get this error:</p> <pre><code>'Uncaught TypeError: Cannot read property 'container' of undefined -- ember.js:2223' </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload