Skip to content

Commit 81cad31

Browse files
committed
refactor(chartjs): id getter for backward compatibility
1 parent 9ad6502 commit 81cad31

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

projects/coreui-angular-chartjs/src/lib/chartjs.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#canvasElement
33
(click)="handleClick($event)"
44
[height]="height() || null"
5-
[id]="id()"
5+
[id]="id"
66
[width]="width() || null"
77
role="img"
88
style="display: none;"

projects/coreui-angular-chartjs/src/lib/chartjs.component.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export class ChartjsComponent implements OnDestroy, OnChanges {
7979
* ID attribute applied to the rendered canvas.
8080
* @return string
8181
*/
82-
readonly id = input<string>(`c-chartjs-${nextId++}`);
82+
readonly idInput = input<string>(`c-chartjs-${nextId++}`, { alias: 'id' });
83+
84+
get id() {
85+
return this.idInput();
86+
}
8387

8488
/**
8589
* The options object that is passed into the Chart.js chart.

0 commit comments

Comments
 (0)