0

I am trying to add a component property as a template variable to a template string. Something like this:

template: `
    <div fxFlexFill>
        <div
            class="wrapper"
            {{ templateVariable }}
            (dblclick)="reset()"></div>
    </div>
`

and templateVariable is:

templateVariable: string = '#abc'

I am getting a runtime error:

Failed to execute 'setAttribute' on 'Element': '{{' is not a valid attribute name.

Is it even possible what I am trying to do?

Thanks

8
  • 2
    No its not, what are you actually trying to solve, could you explain that, maybe there is a better way to solve your original problem! Commented Jul 10 at 9:18
  • It's hard for me to understand why you are even trying this. Commented Jul 10 at 9:18
  • 1
    But why do you want to have "different" names? What is the ultimate goal of this? Commented Jul 10 at 9:27
  • 1
    For debugging purposes, I think you can use a custom attribute/class etc. Or even better, you can use the debugger to see the context better. Commented Jul 10 at 9:57
  • 1
    @Mark try using angular devtools Commented Jul 10 at 10:00

0

Browse other questions tagged or ask your own question.