Home > Blockchain >  Angular interpolation for variable with percent sign in its name
Angular interpolation for variable with percent sign in its name

Time:06-21

I need to display value of variable with percent sign in name: Wifi_%.

When I use{{Wifi_%}} in template, I got Failed to compile widget html. Error: Cannot redefine property: ɵfac while compiling my widget.

When I use{{Wifi}} in template, value is being displayed. But I can't modify the name because I got it from third-party data source.

Is there any interpolation option in Angular to cover my case?

CodePudding user response:

Assign it to an object :


state = { 'Wifi_%': 12 };

You can then use array syntax to read it

{{ state['Wifi_%'] }}
  • Related