あるSEのつぶやき・改

ITやシステム開発などの技術に関する話題を、取り上げたりしています。

Fix:ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'state' Error: Cannot match any routes

Angular で OAuth の処理を行っている際に、以下のエラーが出力されました。

ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'state' Error: Cannot match any routes. URL Segment: 'state' at Anonymous function (http://localhost:4200/vendor.js:66475:17) at CatchSubscriber.prototype.error (http://localhost:4200/vendor.js:90349:17) at Subscriber.prototype.error (http://localhost:4200/vendor.js:87088:9) at Subscriber.prototype.error (http://localhost:4200/vendor.js:87068:13) at Subscriber.prototype.error (http://localhost:4200/vendor.js:87088:9) at Subscriber.prototype.error (http://localhost:4200/vendor.js:87068:13) at Subscriber.prototype.error (http://localhost:4200/vendor.js:87088:9) at Subscriber.prototype.error (http://localhost:4200/vendor.js:87068:13) at TapSubscriber.prototype.error (http://localhost:4200/vendor.js:95082:9) at Subscriber.prototype.error (http://localhost:4200/vendor.js:87068:13)

これ、出力されているエラーの通りで、ルーティングの設定で state がないよと言われています。

なので、ルートの設定に'state'を追加してあげれば問題は解消します。

const routes: Routes = [
  {
    path: 'state',
    component: SomeComponent
  }
];