I have a lock action defined on my notes route. When I navigate directly to note/edit and the this.send('lock', model); throws an error because nothing handled it, but when I go to note and click the edit button the action goes to the notes route and it all works as I expect. Why is the action handled differently on a direct navigation to note/edit compared to note then clicking edit?
Created
January 15, 2015 17:09
-
-
Save RyanHirsch/9706032836aae78d6407 to your computer and use it in GitHub Desktop.
note/edit action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // note/edit/route.js | |
| export default Ember.Route.extend({ | |
| afterModel: function(model) { | |
| if(!model.get('canEdit')) { | |
| this.transitionTo('note', model); | |
| } | |
| else { | |
| this.send('lock', model); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Router.map(function() { | |
| this.resource('notes', { path: '/' }, function() { | |
| this.resource('note', { path: '/:note_id' }, function() { | |
| this.route('edit'); | |
| }); | |
| this.route('new'); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment