Last active
December 27, 2017 04:54
-
-
Save averydev/3f6915c6438a1cde84b26cce1cf52846 to your computer and use it in GitHub Desktop.
Async of Swim: Dynamic Segments.
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
//In your route | |
import Route from '@ember/routing/route'; | |
import { task } from 'ember-concurrency'; | |
export default Route.extend({ | |
model: function (params){ | |
return { | |
blog: this.get('blogTask').perform(params.blog_id)}; | |
}, | |
blog: task(function *(blogId){ | |
let blog = yield this.get('store').findRecord('blog', blogId ); | |
return blog; | |
}) | |
}); |
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
Router.map(function() { | |
this.route('blog',{path:"/blog/:blog_id"}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
blogTask does not exist. The task is ‘blog’