mercredi 27 décembre 2017

Angular2 Router Navigation

I'm trying to test out router navigation in my application, however each time I attempt to navigate to my url I get thrown back to the homepage.

The router should navigate to the next page when the user selects a row to complete a form, like this:

  onUserRowSelect(event): void {
    this.router.navigate(['myforms']);}

However, myforms is not being navigated to, heres how I defined the routes:

    const routes: Routes = [
  {
    path: '',
    component: UserAdminComponent,
    children: [
      {
        path: 'createuser',
        component: CreateUserComponent
      },
      {
        path: 'updateuser',
        component: UpdateUserComponent,
        children: [
          {
            path: 'myform',
            component: UpdateFormComponent,
          }
        ]
      },
    ]
  },

];

So the navigate to myURL/useradmin/updateuser/updateform does not work at all (if the child routes are working even).

I can elaborate more if needed. Thank you




Aucun commentaire:

Enregistrer un commentaire