Last active
December 29, 2017 20:50
-
-
Save averydev/0cb04b4e88f3c97db86b7d6a1aa7a874 to your computer and use it in GitHub Desktop.
Async of Swim: Nested Routes. Replace route with Ember Concurrency Task
This file contains 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
// routes/blog/comments.js | |
model: function (params){ | |
return { | |
comments: this.get('commentsTask').perform() | |
}; | |
}, | |
commentsTask: task(function *(){ | |
let blog = yield this.modelFor('blog').blogTask; | |
let comments = yield blog.get('comments'); | |
return comments; | |
}) |
This file contains 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
//Updated new router.js | |
Router.map(function() { | |
this.route('blog',{path:"/blog/:blog_id"}, function (){ | |
this.route('comments', {path:"/comments"}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment