1
Hello, I published an angular application on an IIS server, and when trying to access the URL defined on the server I get the following error:
Error shown: "Cannot match any Routes. URL Segment: 'Testdrive'"
I don’t know what to do, I looked on the internet and saw something about routes. Down here I left the codes of my routes..
Route codes
import { Routes } from '@angular/router'
import { Personal, Dealers, Agendamento, Finalizados } from '../2 - WebSite/1 - Formulario';
import { BaseNumerica } from '../1 - Shared';
export const routes: Routes = [
{path: '', component: BaseNumerica, children:
[
{path: '', pathMatch: 'full', redirectTo: 'dados-pessoais'},
{path: 'dados-pessoais', component: Personal, },
{path: 'dealers', component: Dealers},
{path: 'agendamento', component: Agendamento}
]
},
{path: 'finalizado', component: Finalizados}
];
Call for routes in the module
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
RouterModule.forRoot(routes),
NgxMaskModule.forRoot()
],
Thank you in advance...
The first screen to be called is 'personal data' and you do not need to define the URL, in principle
From there, I call the other Urls, that way
this.router.navigate(['dealers'']);
As my IIS is local, the URL provided by it was: 'localhost/testedrive'
– Guilherme Nunes
Please enter the link that uses these routes, and how is the
<routoutlet>
?– Marconi
William, take a look at my little study project, maybe something that can help you: https://stackblitz.com/edit/me-project_angular-6-iuwsch
– Marconi
@Marconi, of course, I will insert my code in the question and I will read a read on your project! I appreciate the help, I need to upload this application even today rsrs
– Guilherme Nunes
In it I have some routes configured, see that in the file
app.component.ts
there’s a tag that calls<router-outlet>
, this tag is responsible for displaying the page you triggered through a link.– Marconi
I discovered the rs problem. In the tag, <base> of index.html, the name of the files folder was missing.
– Guilherme Nunes
Post the answer for us to see William!
– Marconi
Sure @Marconi, I’ll post below
– Guilherme Nunes