Skip to content

Commit c1a6b01

Browse files
[UI] Use Angular property binding for SVG fill attribute (#3542)
This PR replaces attr.fill="{{ fillRef }}" with [attr.fill]="fillRef" in SVG polygon bindings for improved Angular consistency and maintainability. The property binding syntax [attr.fill] is the standard Angular approach for dynamic attribute values, ensuring type safety, better template parsing, and alignment with the rest of the codebase. Co-authored-by: jasonlee6789 <jasonleenz369@gmail.com>
1 parent 5fe2052 commit c1a6b01

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

ui/src/app/edge/live/energymonitor/chart/section/abstractsection.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export abstract class AbstractSection {
203203
}
204204

205205
/**
206-
* attr.fill="{{ fillRef }}" has to be specific if using Safari (IOS Browser)
206+
* [attr.fill]="fillRef" has to be specific if using Safari (IOS Browser)
207207
* otherwise Energymonitor wont be displayed correctly
208208
*/
209209
protected adjustFillRefbyBrowser(): void {

ui/src/app/edge/live/energymonitor/chart/section/consumption.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<svg:stop offset="100%" stop-color="var(--ion-color-warning)" />
1313
</svg:linearGradient>
1414
</svg:defs>
15-
<svg:polygon [attr.points]="energyFlow.points" attr.fill="{{ fillRef }}" />
15+
<svg:polygon [attr.points]="energyFlow.points" [attr.fill]="fillRef" />
1616
<svg:polygon [@Consumption]="stateName" [attr.points]="energyFlow.animationPoints"
1717
style="fill: var(--ion-item-background)" />
1818
</svg:g>

ui/src/app/edge/live/energymonitor/chart/section/grid.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<svg:stop offset="100%" stop-color="var(--ion-color-dark)" />
1212
</svg:linearGradient>
1313
</svg:defs>
14-
<svg:polygon [attr.points]="energyFlow.points" attr.fill="{{ fillRef }}" />
14+
<svg:polygon [attr.points]="energyFlow.points" [attr.fill]="fillRef" />
1515
@if (buyAnimationTrigger) {
1616
<ng-container>
1717
<svg:polygon [@GridBuy]="stateNameBuy" [attr.points]="energyFlow.animationPoints"

ui/src/app/edge/live/energymonitor/chart/section/production.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<svg:stop offset="100%" stop-color="var(--ion-color-production)" />
1313
</svg:linearGradient>
1414
</svg:defs>
15-
<svg:polygon [attr.points]="energyFlow.points" attr.fill="{{ fillRef }}" />
15+
<svg:polygon [attr.points]="energyFlow.points" [attr.fill]="fillRef" />
1616
<svg:polygon [@Production]="stateName" [attr.points]="energyFlow.animationPoints"
1717
style="fill: var(--ion-item-background)" />
1818
</svg:g>

ui/src/app/edge/live/energymonitor/chart/section/storage.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<svg:stop offset="100%" stop-color="var(--ion-color-success)" />
1313
</svg:linearGradient>
1414
</svg:defs>
15-
<svg:polygon [attr.points]="energyFlow.points" attr.fill="{{ fillRef }}" />
15+
<svg:polygon [attr.points]="energyFlow.points" [attr.fill]="fillRef" />
1616
@if (chargeAnimationTrigger) {
1717
<ng-container>
1818
<svg:polygon [@Charge]="stateNameCharge" [attr.points]="energyFlow.animationPoints"

0 commit comments

Comments
 (0)