简体   繁体   English

灰烬如何通过单击按钮打开外部链接

[英]ember how to open external link from a button click

In Ember 2.12, Is it possible to call an action on a button click which navigates the user to an external link (like bbc.com for example). 在Ember 2.12中,是否可以通过单击按钮来调用操作,该按钮会将用户导航到外部链接(例如bbc.com)。 I thought the transitionTo will only know the routes declared in router.js 我以为transitionTo只知道router.js中声明的路由

Just use window.open . 只需使用window.open this is standard javascript. 这是标准的javascript。 Or do window.location = 'http://example.com' 或者做window.location = 'http://example.com'

Try it like this 像这样尝试

function goToPage()
{
    document.location.href = "you_url"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM