I have the following code :
<my-comp [title]="Foo's component"></my-comp>
I have tried many things (''
, \'
, \\'
, \''
, ...)to escape the '
in, but I didn't manage to do it.
How can I do this ?
It seems that title is a component property, hence it expects a variable or a string. I assume the correct syntax would be:
<my-comp [title]="'Foo\'s component'"></my-comp>
Adding a single quote before and after
You're binding to the title
property, which is probably of type string.
What you're actually doing is binding it to a javascript (well.. angular2) expression, which is Foo's component
but that's not a valid expression.
What you should be doing is:
title
property without the binding syntax, simply title="Foo's Component"
[title]="'Foo\'s component'"
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With