ember “link-to” helper to support “anchor to jump to an element in the page”

天涯浪子 提交于 2019-12-11 05:15:29

问题


I want to pass queryparams and anchor element name in the link-to. like this

localhost.domain.com?get=100&interviewId=11#4

I used query params to construct get=100&interview=11 , something like this

{{#link-to 'domain.url' (query-params get=100 interviewId=11)class="btn btn-info"}}

Link

{{/link-to}}

How to generate the link with anchor using ember link-to ?

Note: Need solution with link-to only, <a href=""> is not needed


回答1:


Install ember-href-to addon,

ember install ember-href-to

You can use href-to helper to generate URL by providing queryParams and routeName.

(concat (href-to 'domain.url' (query-params get=100 interviewId=4)) propName)


来源:https://stackoverflow.com/questions/40358067/ember-link-to-helper-to-support-anchor-to-jump-to-an-element-in-the-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!