我只是模糊地使用了Iron-router,而且我想从我发现使用铁路由器非常有用的项目转换。调整此代码以使用Flowrouter的最佳方法是什么?
CourseController = AppController.extend({
waitOn: function() {
// course ID
var courseID = this.params._id;
// Course subscriptions
return [
// Wait for the course to be available
this.subscribe("singleCourse", courseID),
];
},
data: function () {
// Return the course
return Courses.findOne();
},
onAfterAction: function () {
// Get the course ID from the URL parameters
var courseID = this.params._id;
// TODO: uncomment the following and figure out why it is generating a browser console error
// Get the course from the database
//var course = Courses.find(courseID).fetch()[0]; // select the zeroeth array item
// Set the site title for SEO
//Meta.setTitle(course.title);
}
});