I'm facing an issue with my application where it doesn't recognize the route even though I have defined and imported it in app.module
.
Whenever I try to redirect to a specific route upon data retrieval, I encounter this exception:
onSubmit(){
this.transactionService.createTransactionIfNotExist(this.video).subscribe(
transaction => this.router.navigate([transaction.currentStep.action, this.video.id, transaction.token ]));
}
transaction.currentStep.action = PreviewStep
this.video.id = 1
transaction.token = f54db125-ca01-4afc-b714-76c127abb261
The exception message is:
Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'PreviewStep/1/f54db125-ca01-4afc-b714-76c127abb261' Error: Cannot match any routes. URL Segment: 'PreviewStep/1/f54db125-ca01-4afc-b714-76c127abb261'
transaction.routing
export const routing: ModuleWithProviders = RouterModule.forChild([
{ path: 'previewStep/:videoId/:transactionId', component: PreviewStepComponent }
]);
transaction.module
import { PreviewStepComponent } from "./components/preview-step/preview-step.component";
import { routing } from './transaction.routing';
@NgModule({
imports: [
CommonModule, routing, FormsModule, SharedModule, RouterModule
],
declarations: [PreviewStepComponent],
providers: []
})
export class TransactionModule { }
app.module
import { AppRoutingModule } from './app-routing.module';
import { TransactionModule } from './transaction/transaction.module';
@NgModule({
declarations: [
],
imports: [
AppRoutingModule,
TransactionModule,
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
HttpModule,
HttpClientModule,
FormsModule
],
providers: [ ],
bootstrap: [AppComponent]
})
export class AppModule { }