Angular2: Uncaught (in promise): Quotes are not supported for evaluation! in the component
You should change your comment
tag in the parent component to this:
<comment [imageURI]="image_path"></comment>
Don't use single quotes when assigning a template binding. Only use them to format strings, like this:
<comment [imageURI]="'path/to/image.jpg'"></comment>
Anyone googling this error: the error contains no useful information and could be thrown for many different reasons so in my case it was impossible to figure out by just looking at the HTML. However if you put a breakpoint in the angular file loaded in your browser (in my case compiler.umd.js
, line 11702, see expression_converter.ts in the @angular/compiler
module, line 395, function visitQuote()
which is what throws the exception) you can drill into the ast
parameter which has properties called location
and uninterpretedExpression
that help you narrow down which component and expression are causing this. In my case it was missing curly braces around an ngClass
parameter.
I got my answer. It comes back to my parent component: The right format is
<comment [imageURI]=image_path></comment>
export class SinglePictureComponent{
username='Salman kkk';
profile_pic="https://scontent-arn2-1.cdninstagram.com/t51.2885-19/s150x150/13743117_1060048037418472_411027981_a.jpg";
comment="I love you";
}
and then set the property is:
<comment [username]=username [comment]=comment [imageURI]=profile_pic></comment>