Andrew Fletcher published: 24 April 2022 1 minute read
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 Fletcher
•
11 Oct 2023
Launching app code in a simulator like Xcode or Android Studio
Loading the code in a platform - in this article, I'll be focusing on Android and iOS. Ionic app shell prompts for iOS and Android devices. Here's a breakdown of the commands:npm run buildThis command is used to build your web app. It's typically associated with web development frameworks...
Andrew Fletcher
•
29 Sep 2023
Setting up an ionic app
Recently a client handed me code that runs an app through iOS and Android. No details about whether native or otherwise. Once I had the opportunity to crawl through the code, definitely not native. Typescript, Angular, Cordova... etc.Glancing at the modification dates, the last...
Andrew Fletcher
•
08 Aug 2022
How to update package.json dependencies to the latest version?
This article works through the steps to update 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...