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

182
Views
Usando ``` location.back()``` de Angular redirigiéndome fuera de mi aplicación angular

Mi aplicación angular se abre en http://localhost:4200/scheduler . He proporcionado un botón en la página de inicio que, al hacer clic, redirige al usuario a http://localhost:4200/cr?crId={{MONGODB_ID}} . La página abierta tiene un botón Atrás, al hacer clic en él llamo a este método.

 backClicked() { this._location.back(); }

este método me está redirigiendo fuera de mi aplicación angular. No soy capaz de entender lo que estoy haciendo mal.

El enrutamiento realizado en app-routing.module.ts se proporciona a continuación como

 import { NgModule } from '@angular/core'; import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; import { environment } from 'src/environments/environment'; import { AuthGuard, LoginGuard } from './guard/'; import { AccessRightsGuard } from './guard/access-rights.guard'; import { UnauthorizedComponent } from './unauthorized/unauthorized.component'; export const APP_ROUTES: Routes = [ { path: '', redirectTo: 'scheduler', pathMatch: 'full' }, { path: 'scheduler', canActivate: [AuthGuard, AccessRightsGuard], loadChildren: () => import('src/app/scheduler/scheduler.module').then(m => m.SchedulerModule), data: { rightsId: environment.accessRights['Home Page'] } }, { path: 'cr', canActivate: [AuthGuard, AccessRightsGuard], loadChildren:() => import('src/app/cr/cr.module').then(m => m.CrModule), data: { rightsId: environment.accessRights['CrewRequiremensComponent'] } }, { path: '401', component: UnauthorizedComponent, }, { path: '**', redirectTo: 'scheduler', pathMatch: 'full' },

El código en el módulo de enrutamiento del módulo del scheduler es

 import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { SchedulerHomeComponent } from './scheduler.component'; const SCHEDULER_ROUTES: Routes = [ { path: '', component: SchedulerComponent } ]; @NgModule({ imports: [RouterModule.forChild(SCHEDULER_ROUTES)], exports: [RouterModule] }) export class SchedulerRoutingModule {}

El código en el módulo de enrutamiento del módulo cr es

 import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CrComponent } from './cr.component'; const CR: Routes = [ { path: '', component: CrComponent } ]; @NgModule({ imports: [RouterModule.forChild(CR)], exports: [RouterModule] }) export class CrModule { }
about 4 years ago · Santiago Gelvez
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!