Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda