Ionic 2: ion-input does not undecode html entities

My Ionic 2 app receives an JSON from the server and some data are html escaped. Example: {“homePhone”:"(11) 33332222"}

if I raw code this value in a input’s value attribute

<input type='text' value='&#40;11&#41; 33332222' />

the browser unescapes this value and shows

(11) 33332222

but in an ionic 2 app, if I bind this homePhone to the ion-input:

<ion-input [(ngModel)]="userdata.homePhone" />

the output in the webview is

&#40;11&#41; 33332222

Anyone knows if it’s possible to set the ion-input to unescape the value? I know I can handle this before binding the object to the ngModel, but I don’t want to to this.

you can try
<div [innerHTML]="userdata.homePhone"></div>

2 Likes

This has no use in my case. I’m using this as an NgModal, in an input that the user will edit.

you can use pipes…and transform the input