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

181
Vistas
splice method only once

I have a stepper inside my application when user selects specific options on first step i want to splice some steps from my step array, but i have splice function on button, so everytime i go back and click button again it splices another item, how can i make it splice only once? here is my array of steps:

.ts

this.stepService.steps = [
  FirstStep,
  SecondStep,
  ThirdStep,
  FourthStep,
  SuccessPageComponent
];

nextStep() {

    let value = { ...this.form.value };
         if (value.type == 'once') {
          this.stepService.steps.splice(2, 1);
        }
    
        if (value.type == 'multiple') {
          this.stepService.steps.splice(1, 1);
        }

}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use slice() instead.

splice() changes the original array, slice() doesn't but both of them returns array object.

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