【发布时间】:2018-11-10 11:28:52
【问题描述】:
我正在使用带有身份验证的 Angular 6、ngx-admin 主题。我想在 url 中传递令牌 id 以重置密码,并以重置密码形式获取该 id,以便我可以将其传递给后端服务器。下面是我的 app-routing.module.ts 文件:
{
path: 'auth',
component: NgxAuthComponent,
children: [
{
path: '',
component: NgxLoginComponent,
},
{
path: 'request-password',
component: NgxRequestPasswordComponent,
},
{
path: 'reset-password/:token',//here i need token
component: NgxResetPasswordComponent,
},
下面是 NgxResetPasswordComponent 文件:
constructor(protected service: NbAuthService,
@Inject(NB_AUTH_OPTIONS) protected config = {},
protected router: Router) {
this.redirectDelay = this.getConfigValue('forms.resetPassword.redirectDelay');
this.showMessages = this.getConfigValue('forms.resetPassword.showMessages');
this.provider = this.getConfigValue('forms.resetPassword.provider');
console.log(this.router.url);//output: /auth/reset-password/dsadasdasfaf
}
我需要从此 URL 中获取“dsadasdasfaf”并将其传递给表单。
【问题讨论】:
标签: angular authentication routing angular-routing