Home > Mobile >  Angular adding single quotes and variable to the component.html not reading the variable and quotes
Angular adding single quotes and variable to the component.html not reading the variable and quotes

Time:01-13

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?

CodePudding user response:

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

enter image description here

  •  Tags:  
  • Related