Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!