typescript Angular4 - 带有打字稿的 routerLink
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45625147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Angular4 - routerLink with typescript
提问by ussefshahid
I have worked with routerLink and it works very well :
我曾与 routerLink 合作过,效果很好:
<a routerLink="inscription" class="btn btn-default">Inscription</a>
<a routerLink="login" class="btn btn-default">Se connecter</a>
I am trying now to deal with routerLink
inside the typescript file. Exactly, when i click on a button, i call a function inside this function i want to call routerLink
how could i do it? and if is calling it will reload the page or it will work exactly the same as the routerLink
above ?
我现在正在尝试处理routerLink
打字稿文件。确切地说,当我点击一个按钮时,我在这个函数中调用了一个函数,我想调用routerLink
我该怎么做?如果调用它会重新加载页面还是会与routerLink
上面的完全相同?
采纳答案by Jorawar Singh
try this
试试这个
<a javascript:void(0) routerLink="inscription" class="btn btn-default">Inscription</a>