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

221
Views
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 answers
Answer question

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 Report
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!