Ionic JIT编译期间出错

mo49yndu  于 2022-12-08  发布在  Ionic
关注(0)|答案(1)|浏览(152)

I have a small question about a compilation error that I'm getting.
At the moment I just cant find the solution for this, eventhough I'm pretty sure it is something very small.
My html for CategoryItemComponent:

<div>
    <ion-row>
      <ion-col size="6" *ngFor="let category of inventory">
        <button class="category-box" (click)="GoToPage({{category.name}})">
          <img class="category-icon" src="{{category.iconPath}}">
          <p class="item-text">{{category.name}}</p>
        </button>
      </ion-col>
    </ion-row>
  </div>

My error message:
Error: Errors during JIT compilation of template for CategoryItemComponent: Parser Error: Unexpected token {, expected identifier, keyword, or string at column 11 in [GoToPage({{category.name}})] in ng:///CategoryItemComponent/template.html@5:46 ("<ion-col size="6" *ngFor="let category of inventory"> <button class="category-box" (click)="[ERROR ->]GoToPage({{category.name}})"> "): ng:///CategoryItemComponent/template.html@5:46, Parser Error: Missing expected ) at column 26 in [GoToPage({{category.name}})] in ng:///CategoryItemComponent/template.html@5:46 ("<ion-col size="6" *ngFor="let category of inventory">
Thanks in advance!

gjmwrych

gjmwrych1#

大括号不应该在那里。它应该只是(click)="GoToPage(category.name)"- @Andrei
谢谢安德烈!

相关问题