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

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -