Javascript 如何在图像src中使用变量

Javascript 如何在图像src中使用变量,javascript,html,angular,typescript,ionic-framework,Javascript,Html,Angular,Typescript,Ionic Framework,如何在图像的src中使用{{}? 我在[src]附近的代码中出错 <ion-list> <ion-item *ngFor="let item of results| async"> <ion-thumbnail slot="start"> <ion-img [src]={{ item.qrlink }}></ion-img> </ion-thumbnail> <ion-l

如何在图像的src中使用{{}? 我在[src]附近的代码中出错

    <ion-list>
  <ion-item *ngFor="let item of results| async">
    <ion-thumbnail slot="start">
      <ion-img [src]={{ item.qrlink }}></ion-img>
    </ion-thumbnail>
    <ion-label>{{ item.Title }}</ion-label>
  </ion-item>
</ion-list>
它连接到如下服务:

export class EncryptionService {
     constructor(private http: HttpClient) { }

    newcheck(checkid: string ,cost: string,toname: string,tocode: string,passcode: string,date: string): Observable<any> {
    return this.http.get(`https://api.test.com/encrypte.php?checkid=${encodeURI(checkid)}&&cost=${encodeURI(cost)}&&toname=${encodeURI(toname)}&&tocode=${encodeURI(tocode)}&&passcode=${encodeURI(passcode)}&&date=${encodeURI(date)}`).pipe(
      map(results => results['Data'])
    );
  }
}
导出类加密服务{
构造函数(私有http:HttpClient){}
newcheck(checkid:string,cost:string,toname:string,tocode:string,passcode:string,date:string):可观察{
返回this.http.get(`https://api.test.com/encrypte.php?checkid=${encodeURI(checkid)}&&cost=${encodeURI(cost)}&&toname=${encodeURI(toname)}&&tocode=${encodeURI(tocode)}&&passcode=${encodeURI(passcode)}&&date=${encodeURI(date)})。管道(
映射(结果=>results['Data'])
);
}
}

它应该是
[src]=“item.qrlink”
src={{{item.qrlink}
。他们不应该混在一起

解释

如果
[src]=“item.qrlink”
变量
item.qrlink
的值使用属性绑定绑定到
[src]
属性。阅读有关模板表达式的更多信息

src={{item.qrlink}}
的情况下,
item.qrlink
的值被插值并分配给属性
src
。阅读更多有关插值的内容

export class EncryptionService {
     constructor(private http: HttpClient) { }

    newcheck(checkid: string ,cost: string,toname: string,tocode: string,passcode: string,date: string): Observable<any> {
    return this.http.get(`https://api.test.com/encrypte.php?checkid=${encodeURI(checkid)}&&cost=${encodeURI(cost)}&&toname=${encodeURI(toname)}&&tocode=${encodeURI(tocode)}&&passcode=${encodeURI(passcode)}&&date=${encodeURI(date)}`).pipe(
      map(results => results['Data'])
    );
  }
}