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

258
Views
Angular: muestra el valor de paso de la página html

Tengo una página que uso para mostrar 3 html diferentes dependiendo de dónde se llame.

En una página tengo:

 openCreateAnagraphics(){ this.router.navigate(["/anagraphics", {customerUpdate: true}]); }

Así que voy a navegar a anagraphics.

ahí tengo en mi anagraphics.page.ts:

 ngOnInit() { this.handleParams(); } handleParams() { let params = this.route.snapshot.params; console.log("this.route.snapshot", this.route.snapshot) console.log("params", params) this.customerUpdate = params.customerUpdate ? params.customerUpdate : false console.log("this.customerUpdate ", this.customerUpdate) }

y en anagraphics.page.html

 <div *ngIf="...."> <div> //this is showed if I come from another way </div> </div> <div *ngIf="customerUpdate"> <div> HELLO // there is the problem </div> </div>

pero solo veo una página en blanco y mi url es

http://localhost:4200/anagraphics;customerUpdate=true

Me gustaría obtener que si hago clic en el botón que llama openCreateAnagraphics, entraré en una página que muestre el html cuando customerUpdate = true.

EDITAR 1:

En mi app-routing.module.ts

 { path: 'anagraphics', loadChildren: () => import('./anagraphics/anagraphics.module').then(m => m.AnagraphicPageModule), canActivate: [AuthGuard], data: { configurator: true, customerUpdate: false } },

pero de esta manera customerUpdate siempre está en false.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Enlace de referencia de mi solución: https://angular.io/api/router/RouterEvent

En su archivo .routing.module.ts agregue datos como los siguientes.

 const routes: Routes = [{ path: '', component: AlertsComponent, data: { // What data you want to pass add that here } }]

Luego obtenga ese valor en su componente común como se muestra a continuación. (Como: aplicación o componente de navegación)

 constructor(public router: Router) { router.events.pipe( filter((e: Event): e is RouterEvent => e instanceof RouterEvent) ).subscribe((e: RouterEvent) => { // Get your route data here }); }
about 4 years ago · Juan Pablo Isaza 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!