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

176
Vistas
How to receive an array as @Input from index.html custom element tag?

I have created a custom element in angular. The element tag is shown as below:

     <test-reco userId="I8763" [productId]="['101','B102']"> </test-reco>

I am calling it in index.html. Now, It has two inputs one is userId that is of type string and another is an array of productId. I am recieveing these as input inside my component as shown below:

    export class test implements OnInit {
       @Input() userid = '';
       @Input() productid: any[];
    }

Inside my component the productId is coming as undefined. Can anyone please tell me what I am doing wrong? I also tried passing it like this:

productId="['101','B102']"

But in this case it came as string and not as an array.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can expload it with (",") Substr 1 and -1 for removing the [ and ]

about 4 years ago · Juan Pablo Isaza Denunciar

0

Your name should be the same as given below.

<test-reco [userId]="I8763" [productId]="['101','B102']"> </test-reco>
export class test implements OnInit {
       @Input() userId= '';
       @Input() productId: any[];
    }
about 4 years ago · Juan Pablo Isaza 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