0

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.

4

1 回答 1

1

尝试使用 Backbone 的路由器来执行导航。

您必须在您的应用程序中设置它的一个实例(每个 BB 应用程序都有一个)。这是执行导航的框架代码:

AppRouter = Backbone.Router.extend({ ... }) //should already be set on your app
app = new AppRouter();
app.navigate('/posts', {trigger: true});
于 2012-12-30T10:13:20.543 回答