0
votes

I have a problem with my route system in my angular project. I receive this error each time I call the reset-password/:token route.
every time I call this route, http://localhost:4200/reset-password?token=token_info, the browser (google chrome) redirects me to http://localhost:4200/reset-password and return this error message.

core.js:1673 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'reset-password'
Error: Cannot match any routes. URL Segment: 'reset-password'
    at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError (router.js:1384)
    at CatchSubscriber.selector (router.js:1365)
    at CatchSubscriber.push../node_modules/rxjs/_esm5/internal/operators/catchError.js.CatchSubscriber.error (catchError.js:34)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:80)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:60)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:80)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:60)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:80)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:60)
    at TapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/tap.js.TapSubscriber._error (tap.js:61)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:3811)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)

On the other hand, all other roads operate

this is my code
app.module.ts

const appRoutes: Routes = [{
    path: '',
    component: LoginLayoutComponent,
    children: [
        { path: '', component: SigninComponent },
        {
            path: 'forgot-password',
            component: ForgotPasswordComponent,
        },
        {
            path: 'forgot-password/confirmation',
            component: ForgotPasswordConfirmationComponent,
        },
        { 
            path: 'reset-password/:token',
            component: ResetPasswordComponent,
        },
        { path: 'signup', component: SignupComponent },
        { path: 'logout', component: LogoutComponent, canActivate: [
            CanActivateViaAuthGuard
           ]
        },
      ]
    },

please can you help me? thanks.

3
It doesn't look like you have a reset-password route? Only a reset-password/:token route?DeborahK
thanks @DeborahK for response. yes, I'm talking about the road with the parameter "token". I corrected my answer.willkoua

3 Answers

1
votes

Add reset-password as a route before { path: 'reset-password/:token', ... } object.

0
votes

Your 'reset-password' route need a token parameter, Probably when you call the route you missed it.

0
votes

You have defined 'reset-password/:token' with token so you need to pass token with that route.

Either you have to pass token with that route or define another route without token.