如何解决“错误:无法匹配任何路线。网址段:“任何东西”

时间:2019-01-26 00:04:07

标签: angular angular-ui-router angular6

我的角度项目中的路线系统有问题。每次调用class ManagerApp(App): def build(self): return TextInput(text='hello world\n') 路由时都会收到此错误。
每次我将此路线称为reset-password/:token时,浏览器(google chrome)会将我重定向到http://localhost:4200/reset-password?token=token_info并返回此错误消息。

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)

另一方面,所有其他道路都在运营

这是我的代码
app.module.ts

http://localhost:4200/reset-password

请你能帮我吗?谢谢。

3 个答案:

答案 0 :(得分:1)

reset-password添加为{ path: 'reset-password/:token', ... }对象之前的路线。

答案 1 :(得分:0)

您的“重置密码”路由需要令牌参数, 可能当您拨打该路线时错过了它。

答案 2 :(得分:0)

您已使用令牌定义了“ reset-password /:token”,因此您需要通过该路由传递令牌。

要么必须通过该路由传递令牌,要么定义没有令牌的另一条路由。