简体   繁体   中英

Angular 2 *ngFor issue

After updating Angular 2 to RC.5 some stranfge error appear:

TypeError: changes.forEachOperation is not a function

and it points to the html part which looks like:

<ion-list>
  <button ion-item menuClose *ngFor="let p of pages" (click)="openPage(p)">
    <ion-icon item-left [name]="p.icon"></ion-icon>
    {{ p.title | translate }}
  </button>
</ion-list>

and which is initialized by such code inside the component:

pages: PageObj[] = [
{ title: "dashboard.Title", component: DashboardPage, icon: "calendar" },
{ title: "transactions.Title", component: TransactionsPage, icon: "cash" },
{ title: "categories.Title", component: CategoriesPage, icon: "pricetags" },
{ title: "budgets.Title", component: BudgetsPage, icon: "briefcase" },
{ title: "personal.Title", component: PersonalPage, icon: "ios-person" }
// { title: "cards.Title", component: CardsPage, icon: "ios-person" }

];

there is also an interface for PageObj. Strangest things about this are that:

  1. It was working with RC.3
  2. Same code is working in Ionic Conference App example.

I compared code and libs in my project and in ionic-conference-app latest example and found out that I was using

"@angular/common": "2.0.0-rc.5",
"@angular/forms": "0.3.0"

and after replacing it with

"@angular/common": "2.0.0-rc.4",
"@angular/forms": "0.2.0"

everything is working fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM