prashantsahni
prashantsahni

Reputation: 2195

Backbone.js navigation to index url

I have listing of posts at http://example.com/posts. Each post has edit link, like

http://example.com/posts#/1/edit

when i click on the link, i am rendering edit post template and saving it. Now the issue is after updating the post, i want to redirect back http://example.com/posts.

when i do Backbone.history.navigate('/posts', true), i find http://example.com/posts#posts in the url.

May be i am missing something.

Upvotes: 0

Views: 358

Answers (1)

Erez Rabih
Erez Rabih

Reputation: 15788

Try using Backbone's Router to perform the navigation.

You must have set an instance of it in you application (every BB app has one). This is the skeleton code to perform the navigation:

AppRouter = Backbone.Router.extend({ ... }) //should already be set on your app
app = new AppRouter();
app.navigate('/posts', {trigger: true});

Upvotes: 1

Related Questions