任何人都可以建议我如何从网址中调用参数(包含特殊字符)。下面是我现在调用param的代码。
ngOnInit() {
this.route.params.subscribe(params => {
let accountrefID = params['accountReferenceID'];
console.log("paramerter is "+accountrefID);
this._accountservice.getAccountSummary(accountrefID).subscribe(accountSummary => {
this.accountSummary = accountSummary;
});
})
}
我的网址看起来像
http://localhost:4200/account/fhdjfhdjfj343445 -- its working
https://localhost:4200/account/fjdhfj$W$Wfjkdjfk= -- its working but the
param是在特殊字符之前拍摄的 我的路由器类如下:
import {RouterConfig, provideRouter} from "@angular/router";
import {AccountSummaryComponent} from "./+accountSummary/account-summary.component";
export const routes: RouterConfig = [
{
path: 'accountSummary/:accountReferenceID', component: AccountSummaryComponent
}
];
export const APP_ROUTER_PROVIDERS = [
provideRouter(routes)
];
请帮助我在哪里可以更改代码以获得正确的参数,包括特殊字符。目前我正在使用RC4。
答案 0 :(得分:0)