0

我有一个从网络服务器获取其内容的离子卡,除了将离子卡点击事件链接到外部 url 之外,一切正常,下面是我的代码

<ion-content no-padding >

      <ion-item no-padding *ngFor="let item of items" >
  <ion-card (click)="goToDetails('{{item.link}}')">



      <img class="images" src="http://mydomain/{{item.captionImage}}">

    <ion-item text-wrap>
      <div class="headings">{{item.title}}</div>
    </ion-item>
      <ion-card-content text-wrap>
        <p>{{item.message}}"</p>
      </ion-card-content>

      <ion-row>
        <ion-col col-9>
          <ion-row>
            <ion-col>


              <img class="owner-logo" src="http://mydomain/{{item.sourceLogo}}">

        </ion-col>
        <ion-col>
<div class="owner-name">{{item.source}}</div>

        </ion-col>
        <ion-col></ion-col>
        <ion-col></ion-col>
        <ion-col></ion-col>
        </ion-row>
        </ion-col>



        <ion-col col-3 text-right>
          <button ion-button clear small color="danger" icon-start (click)="regularShare(index)">
            <ion-icon name='share'></ion-icon>
            Share
          </button>
        </ion-col>
      </ion-row>

    </ion-card>
    </ion-item>

</ion-content>

我的 .ts 文件是

public goToDetails(url : string){

  let target = "_self";
  this.theInAppBrowser.create(url,target,this.options);
}

我收到此错误消息 Uncaught Error: Template parse errors: Parser Error: Got interpolation ({{}}) where expression is expected at column 13.

4

1 回答 1

1

你需要像这样写离子卡

<ion-card (click)="goToDetails(item.link)">

如果您在构建指令中click, ngIf,则不需要使用插值

于 2018-10-05T11:53:23.957 回答