I want to assign variable's value from Component to object string within Angular view.
This is snippet from typescript file
@Input() someVariable: string = '';
let someValueFromTypeScript: string = '';
ngOnChanges(): void {
this.someValueFromTypeScript = (this.someVariable) ? this.someVariable : 'default_value';
}
This is snippet from corresponding template
<div data-dl='{"prop1":"val1", "prop2":"val2", "prop3":"someValueFromTypeScript"}'>
...
</div>
I tried using string interpolation but it didn't worked. One constraint is that value to data-dl should be string only, so I cannot do something like:
<div attr.data-dl="JSON.stringify value of property">
...
</div>