Emberjs Routing: Page reloads on every link click

2019-09-20 17:15发布

I have an Ember js app, with pushstate enabled. Say I am on a page www.xyz.com/start and I have proper link on the page (www.xyz.com/abc/def) and I have defined route in ember for /abc/def. But every time I click on the link, the page is reloaded instead of directly being served by the Ember router. What is the correct way to do this?

2条回答
Ridiculous、
2楼-- · 2019-09-20 17:39

When you say a "proper link" do you mean an <a href> tag? If so, you should be using the {{link-to}} helper instead. See http://emberjs.com/guides/templates/links/

查看更多
混吃等死
3楼-- · 2019-09-20 17:53

You have to use the link-to helper instead of basic a href links.

{{#link-to 'abc/def'}}go to def{{/link-to}}

Where 'abc/def' is the route name.

See : http://emberjs.com/guides/templates/links/

查看更多
登录 后发表回答