Ember: route ID is lost after transition .retry () - Am I doing something wrong?

See JSFiddle: http://jsfiddle.net/cyclomarc/MHvrH/3/

There are many samples that show how to implement authentication in Ember. To protect access to the route, you will be redirected to the login page if you do not have a valid token. After a successful login (thus, after receiving a valid token), you will be redirected to the initial requested page.

Implementation: before redirecting to the login, you save the requested transition in the object; after logging in, you read the property of the object and perform the .retry transition.

login: function () {
    var self = this;

    App.Session.set('token', '1234567890');
    var attemptedTransition = App.Session.get('attemptedTransition');

    if (attemptedTransition) {
      attemptedTransition.retry();
    }
    ....

, URL. JSFiddle. , . , , , . "" ( ), "" .

, , "" URL- (e.g. browse to http://yyy/index.html#/publications/1), .retry . , ( ) . URL : http://yyy/index.html#/publications/undefined...

? ?

:

, , , ModelsArray . - Ember.data?

(Ember.inspect(savedTransition)):

    {router: [object Object], promise: [object Object], 
data: [object Object], resolvedModels: [object Object], 
providedModels: [object Object], 
providedModelsArray: <App.Publication:ember330:2>, 
sequence: 2, params: [object Object], 
targetName: publications.show, isAborted: true} 

(Ember.inspect(savedTransition)):

    {router: [object Object], promise: [object Object], 
data: [object Object], resolvedModels: [object Object], 
providedModels: [object Object], 
providedModelsArray: , 
sequence: 1, params: [object Object], 
targetName: publications.show, 
urlMethod: null, isAborted: true} 
+1
1

, . findById (id). : App.Publication.find(params.publication_id).

0

All Articles