简体   繁体   English

Angular 2 * ngFor问题

[英]Angular 2 *ngFor issue

After updating Angular 2 to RC.5 some stranfge error appear: 将Angular 2更新为RC.5后,会出现一些stranfge错误:

TypeError: changes.forEachOperation is not a function

and it points to the html part which looks like: 它指向html部分,看起来像:

<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. 还有一个PageObj接口。 Strangest things about this are that: 最奇怪的是:

  1. It was working with RC.3 它正在与RC.3合作
  2. Same code is working in Ionic Conference App example. 相同的代码在Ionic Conference App示例中有效。

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 一切都很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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