I'm currently working on a function that will replace all URLs in a JSON with buttons that redirect to another function. The modified JSON, complete with the new buttons, will then be displayed on my website.
In my component.ts file, the section where the JSON is processed looks like this:
} else {
this.downloading = false;
this.container = <aContainer>json;
this.loadedJson = JSON.stringify(json, null, 2);
Once the JSON is loaded, it is rendered on the website using the following code snippet in the component.html file:
<h3>Unrecognized JSON data:</h3>
<pre>{{loadedJson}}</pre>
I am considering using a regular expression (regExp) to identify and replace URLs within the JSON data, replacing them with 'url://'.
let regExp = /url:\/\//
Does anyone have suggestions on how I can create code that detects URLs and replaces them with buttons that link to another function?
Thank you for your help!