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

225
Visualizações
JSON Object as string for @Input - Angular

I am having a component's html in which I have a property called info which is referred in a service file. The problem is info is a json string which will be parsed in the service (by angular). I have a scenario where one of the values of json contains a quote ('). The problem is I am unable to bypass the quote in html without running into a compilation error. Is there any solution for the same?

The following is an example snippet

<my-component id="wt_tab_206_000000010wrap" class="form-group  inlineblock"
                    [info]="{'id':'wt_tab_206_000000010','value':'LoadDatanew','disabled':false,'readonly':false}"
                    filterFields="N"></my-component>

In the above example, [info] is the property of concern. In that the value key is supposed to have the value like LoadData'new. But parsing it like LoadData\'new is not solving the problem. Any help is appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can pass the data as a object without stringifying it.

Just pass it like this:

<my-component id="wt_tab_206_000000010wrap" class="form-group inlineblock"
                    [info]="obj"
                    filterFields="N">
</my-component>

In your .ts file:

public obj = {
  id: 'wt_tab_206_000000010',
  value: 'LoadDatanew',
  disabled: false,
  readonly: false
}
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