我有一个按钮可以在Angular应用程序中调用动态routerlink:
> pip install more_itertools
在我的组件中:
request.PrivateKey.ProviderName = "Microsoft Smart Card Key Storage Provider";
request.PrivateKey.KeyUsage = X509PrivateKeyUsageFlags.XCN_NCRYPT_ALLOW_SIGNING_FLAG;
request.PrivateKey.KeySpec = X509KeySpec.XCN_AT_NONE;
虽然这样做是将我的字符串附加到当前URL的后面,所以最终显示为:
http://my.company.com/mycurrentroute/http:/my.company.com/Job/Notes
请注意为什么还要从我的baseUrl中删除斜杠
我在做什么错?正确的答案应该是“ http://my.company.com/Job/Notes”
答案 0 :(得分:0)
您不应将baseUrl附加在goTo()返回URL上。由于RouterLink在运行您的应用程序时已经将当前的baseUrl作为目标,因此默认情况下它将针对:
http://my.company.com/
您要做的只是添加其子路由示例:
goTo() {
return './Job/Notes'; // May it be "/Job/Notes"
}
或者您可以直接在routerLink上指定它:
<a [routerLink]="['./Job/Notes']" type="button"> // "./" pertains to the current parent route with the baseUrl
Go To
</a>