0

I was looking at routes in backbone and I was wondering if I can do the following:

routes: {
    '': 'posts',
    'posts?page=:page': 'posts'
}

This would allow me to do just a plain index of posts and also add pagination to that index of posts.

Is this something that is ok or is there a better way to do this?

user3379926
  • 3,855
  • 6
  • 24
  • 42

1 Answers1

0

Is using a query parameter a requirement? If not, you can use the Router's param functionality:

routes: {
    '': 'posts',
    "page/:page": "posts"   // #page/N
}
pdoherty926
  • 9,895
  • 4
  • 37
  • 68