vendredi 22 octobre 2021

Add dynamic value (from Angular) in an svg icon

I have an svg icon into which I want to display the value of a typescript variable. That variable comes from an api. Is that possible??

svg: <svg id="Component_102_1" data-name="Component 102 – 1" xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"> <rect id="Rectangle_1674" data-name="Rectangle 1674" width="32" height="20" rx="10" fill="#0e70c7"/> </svg>

ts: this.countLife = this.filterLifePolicies.length;

html: <img class="ppp" id="what" src="../../assets/images/Component102_1.svg">

So, somehow I need to pass the content of countLife into that svg.




Aucun commentaire:

Enregistrer un commentaire