0

I am using Angular 13 and in my component.html I have this:

This line works:

<highcharts-chart [constructorType]="'stockChart'"></highcharts-chart>

Now, when I have a variable:

myvalue = 'stockChart';

And do this:

<highcharts-chart [constructorType]="myvalue"></highcharts-chart>

or

<highcharts-chart [constructorType]="'myvalue'"></highcharts-chart>

or

<highcharts-chart [constructorType]="{{myvalue}}"></highcharts-chart>

The 3 above don't work but the first one does.

How can I get it to work using the variable?

deszok
  • 145
  • 2
  • 14
  • 1
    `` is a valid syntax. Could you do a live example of this problem with the library you're using? – Jacopo Sciampi Jan 11 '22 at 18:50
  • First one from the section of 3 is valid as @JacopoSciampi pointed out. – Chaka15 Jan 11 '22 at 18:52
  • Hi @deszok, Using `[constructorType]="myvalue"` works perfectly fine. Please check this live example: https://stackblitz.com/edit/highcharts-angular-basic-line-p44v1a?file=src%2Fapp%2Fapp.component.html – ppotaczek Jan 12 '22 at 09:46

1 Answers1

2

you can try escape characters in component.ts and bind that value in html

enter image description here

Anirban
  • 166
  • 3