I have an angular component, where I am changing the battery svg status fill by using the def.
<svg #batteryIcon width="95%" height="95%" viewBox="0 0 260 399">
<defs>
<linearGradient #batteryLG id="batteryLG" x1="0.5" y1="1" x2="0.5" y2="0">
<stop offset="0%" stop-opacity="1" stop-color="royalblue" />
<stop [attr.offset]="value" stop-opacity="1" stop-color="royalblue" />
<stop [attr.offset]="value" stop-opacity="0" stop-color="royalblue" />
<stop offset="100%" stop-opacity="0" stop-color="royalblue" />
</linearGradient>
</defs>
<svg:rect id="rect" fill="url(#batteryLG)" x="-30" y="0" width=25% height="100%" ></svg:rect>
</svg>
This works fine if i have a single instance of the component. If i have multiple components which have different values for "value", all the components show the fill of the first component.
Not sure where I made a mistake
Similar issue : Updating offsets dynamically
PS: I actually have a long path for battery icon.. Somehow Stackoverflow isn't accepting a long path. That's the reason i replaced the path with rect. If it was a rect I can change the height of it to achieve what I need :)