NsdHSO
NsdHSO

Reputation: 153

The route is not working properly Angular

It doesn't do me the right thing, Url changes it but the page doesn't render it. I have two home and jobs routes, I watched doc. From Angular, but not working This is routing.module

import { Route, Routes, RouterModule } from '@angular/router';
import { NavigationJobsComponent } from './../jobs/navigation-jobs/navigation-jobs.component'
import { InputFieldComponent } from './components/input-field/input-field.component'
export const routes: Routes = [
  {
    path: "",
    component: InputFieldComponent

  },{
    path: "jobs",
    component: NavigationJobsComponent
  },

];

This is dependency from module RouterModule.forRoot(routes),

Surely someone has been hit by this before. Maybe this topic will be useful to someone, Excuse the emotions

Upvotes: 0

Views: 409

Answers (2)

Sameyer
Sameyer

Reputation: 1

As KShewengger has said above, look in your template if you're using the <router-outlet></router-outlet>. If you're using a navbar to navigate between routes, then you have to put the <router-outlet></router-outlet> in your navbar Component.

If not, try to use the <router-outlet></router-outlet> in your app.component.html (down if possible).

It would be nice if you could share your whole code about your issue, for better understand where could be it.

Upvotes: 0

KShewengger
KShewengger

Reputation: 8269

"but the page doesn't render it"

It seems like you forgot to add <router-outlet></router-outlet> in your AppComponent's Template

Have created a Stackblitz Demo for your reference

Upvotes: 2

Related Questions