Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
angular2 wizard navigation history

https://github.com/maiyaporn/angular2-wizard

https://maiyaporn.github.io/angular2-wizard-demo/ (DEMO)

So I'm using this simple wizard for my application and I'm trying to figure out how I can navigate back and forth (either using the browser's back and forward buttons or click on the mouse to go back or forwards).

If you go through the demo provided, when you reach step 2 but want to go back, it seems like the only way to actually go back to step 1 is to click the "previous" button.

I want to be able to actually click "back" (in my case, with my mouse) so I can go back to step 1; clicking "back" with my mouse ends up taking me back to a previous page instead.

I've tried messing with history.pushState() but it still does not go back to step 1 like I want.

This is a little confusing and new to me as I am getting my feet wet with angular2. Since this is a parent-with-many-child-components on one page, it doesn't look like I can use hashes (I could be wrong).

Just would like to get some help on what I could take a look at to point me in the right direction.

Thanks in advance.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Believe I figured out the answer to my question.

It may just be a hack and probably not a proper answer but it's working like I want it for now.

I basically went into the wizard-component.ts file and gave each step a hash. I then used onpopstate to listen for the history and used the goToStep method to find the correct step (by the hash).

over 4 years ago · Santiago Trujillo Denunciar

0

You are going to want to use Routing.

Follow the tutorial: https://angular.io/docs/ts/latest/tutorial/toh-pt5.html

In brief

  1. Add <base href="/"> to index.html
  2. Import RouterModule in root module: import { RouterModule } from '@angular/router';
  3. Add Routes to root module: RouterModule.forRoot([{ path: 'heroes', component: HeroesComponent }])
  4. Insert router outlet into html template: <router-outlet></router-outlet>
  5. Start using routerLinks: <a routerLink="/heroes">Heroes</a>
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda