javascript - Meteor: IronRouter does not trigger notFound rule -


i meteor app use ironrouter client-side routing.

my routing code looks follows:

router.map(function() {      this.route('story', {         path: '/story/:_id',         data: function() {             return stories.findone({displayid: +this.params._id});          },         notfound: 'storynotfound'     }); }); 

i have 2 templates corresponding route:

<template name="story">     welcome story: {{this.displayid}}. </template>  <template name="storynotfound">     story not found </template> 

problem: 'storynotfound' template never rendered, not when

stories.findone({displayid: +this.params._id})  

returns undefined.

instead, 'story' template rendered text "welcome story: ".

what missing?

have tried replacing notfound: notfoundtemplate ? iron router example uses notfound find notfoundtemplate in source code , worked me.

router.map(function() {      this.route('story', {         path: '/story/:_id',         data: function() {             return stories.findone({displayid: +this.params._id});          },         notfoundtemplate: 'storynotfound'     }); }); 

Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -