Reputation: 7735
I'm getting no route named view form although i have it defined correctly.
Router.route '/form/:_id', (->
@render 'viewForm', data: ->
console.log 'id' + @params._id
forms.findOne _id: @params._id
return
),
name: 'forms.show'
layoutTemplate: 'layout'
I redirect programmaticaly using this :
Router.go('forms.show', {_id: id}, {query: 'q=s', hash: 'hashFrag'});
on console my routes are not even listed using :
Router.routes
is there an issue with name attribute ?
Upvotes: 0
Views: 119
Reputation: 7735
here is how i solved the problem:
Router.route '/form/:_id',
name: 'forms'
layoutTemplate: 'layout'
action: ->
@render 'viewForm', data: ->
console.log 'id' + @params._id
forms.findOne _id: @params._id
return
Upvotes: 0
Reputation: 681
The name attribute looks fine, does removing the extra parentheses fix the problem?
So the route function would instead be:
Router.route '/form/:_id', ->
@render 'viewForm', data: ->
console.log 'id' + @params._id
forms.findOne _id: @params._id
return
,
name: 'forms.show'
layoutTemplate: 'layout'
Upvotes: 1