iron-router not working
webstudiopro opened this issue · comments
Hi,
When I try to add a route "bar" to routes.coffee but the router doesn't pick it up and give message:
"Oops, this page can't be found"
No other errors reported in firefox debugger
Meteor release: 0.8.1.1
--> routes.coffee
Router.map ->
@route 'home',
path: '/'
@route 'dashboard', @route 'bar', --> /client/views/bar/bar.html Any ideas? Got stuck here !
path: '/dashboard'
onBeforeAction: ->
AccountsEntry.signInRequired(@)
@route 'notFound',
path: '*'
where: 'server'
action: ->
@response.statusCode = 404
@response.end Handlebars.templatesadded
path: '/bar'
data: ->
Meteor.user()
onBeforeAction: ->
AccountsEntry.signInRequired(@)
<p">Test template bar
thx
Fret Benny
You need to change the order. Iron router goes through all defined routes and picks the first matching. Since the notFound
is defined before the bar
, it first matches the notFound
and never reaches your bar
route.
Thx udondan !
Beginners mistake -:)