My problem is I have to create post but once I thought to take me to the page that shows me the post I created my url so
midomain.com / post / id
meteor and use iron-router but when I post the remains loading forever and never shows me the page
midomain.com / post / id
I'm doing the subscriptions and publications also manually...
Configuration iron-router
Router.map(function(){
this.route('showSnippet', {
path:'/snippets/:_id',
controller:'SnippetShowController',
action:'show'
});
this.route('home', {
path:'/',
template:'form'
})
});
SnippetShowController = RouteController.extend({
before: function () {
var _id = this.params._id;
if(App.subs.snippet)
App.subs.snippet.stop();
App.subs.snippet = Meteor.subscribe('snippet', _id);
},
data: function () {
return Snippets.findOne({_id: this.params._id});
},
run: function () {
this.render('showSnippet');
}
});
subscriptions
App = {
subs: {
snippets: Meteor.subscribe('snippets')
}
};
publications
Meteor.publish('snippet', function (id) {
return Snippets.find({_id: id});
});
I want to clarify that 'posts' I mean my collection called 'snippets' after performing validation when clicking on the 'submit' form I have
Router.go ('showSnippet');`
Thanks!
Sorry for my English but I use Google translator