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.
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
}