Skip to main content

The issue

Text through the app is being rendered as

<p>Depletion estimates, Age and size composition, Catch, Effort, Catch rates, Fishing mortality</p>

Therefore, in this instance the HTML p tags are being displayed along with the text.

 

The code

Currently the code outputting this is written as:

<ion-item lines="full">
     <ion-label class="ion-text-wrap">Indicators:</ion-label>
     <ion-text class="right ion-text-wrap">{{ status.Indicators | removeComma }}</ion-text>
 </ion-item>

 

Solution

To resolve this issue, the status.Indicators needs to be an attribute of the ion-text using innerHTML.  You should use the innerHTML attribute binding like this:

[innerHTML]="status.Indicators"

Therefore, in the code appearing as

<ion-item lines="full">
     <ion-label class="ion-text-wrap">Indicators:</ion-label>
     <ion-text class="right ion-text-wrap" [innerHTML]="status.Indicators"></ion-text>
 </ion-item>

 

Testing

Running the app again post the change above and the output is

Depletion estimates, Age and size composition, Catch, Effort, Catch rates, Fishing mortality

 

Related articles

Andrew Fletcher29 Sep 2023
Setting up an ionic app
Recently a client handed me code that runs an app through iOS and Android. &nbsp;No details about whether native or otherwise. &nbsp;Once I had the opportunity to crawl through the code, definitely not native. &nbsp;Typescript, Angular, Cordova... etc.Glancing at the modification dates, the last...
Andrew Fletcher08 Aug 2022
How to update package.json dependencies to the latest version?
This article works through the steps to update&nbsp;dependencies in package.json file to the latest version. Use npm-check-updates or npm outdated to suggest the latest versions. npm-check-updates is a utility that automatically adjusts a package.json with the latest version of all...