我有一个组件,它有一个输入参数:
import {Component,Input} from '@angular/core';
@Component({
selector: 'comment' ,
template: `
<div class="col-lg-6 col-md-6 col-xs-6 thumb">
<div class="post-owner">
<div class="media">
<div class="media-left">
<a href="#">
<img class="media-object rounder" src=imageURI >
</a>
</div>
</div>
</div>
</div>`
})
export class CommentCompoent{
@Input() imageURI="";
}
在父组件中,我向它传递了一个图像路径,如下所示:
<comment [imageURI]='image_path'></comment>
问题是,当我运行它时,它会抱怨:
EXCEPTION: Error: Uncaught (in promise): Quotes are not supported for evaluation!
那我该怎么办?
Update:当我移除父组件中的[imageURI]='image_path'
时,它工作正常,并且它完美地显示了组件的其余部分