kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 192 forks source link

Define routers by looping an array? #340

Open crapthings opened 9 years ago

crapthings commented 9 years ago
routers = [
    'books'
    'authors'
    'products'
]

for route in routers

    console.log "#{route} outside an router."

    FlowRouter.route "/#{route}",
        action: ->
            console.log "#{model} inside an router."
            BlazeLayout.render 'layout',
                main: model

no matter which router that i access it only renders the last template "products"

the console looks like

books outside an router. authors outside an router. products outside an router. products inside an router.

you can see the log inside action only get print once

arunoda commented 9 years ago

You can auto generate routes like this. There is no issue with that. It's hard for me to read coffeescript. May be someone can help.