In my host obtain this error:
EXCEPTION: Expression 'observable | async in AppComponent@6:25' has changed after it was checked. Previous value: '2,4,6,8,10'. Current value: '[object Object]' in [observable | async in AppComponent@6:25]
At first I used it in the constructor, but I change it out, because I thought that using the return would be solved, but still the same,
import {Component, Inject} from 'angular2/core'
import {Observable} from 'rxjs/Observable';
import 'rxjs/Rx';
@Component({
selector: 'test',
template: `
<div *ngFor="#item of observable | async"> test: {{ item }}</div>
`
})
export class AppComponent {
public observable: Observable<Array<number>>;
constructor(){
//This no works without error
this.observable = Observable.range(1, 10)
.filter((paraCadaUno: any) => paraCadaUno % 2 === 0 )
.toArray();
//This no works without error
//this.test();
}
test(): any{
return this.observable = Observable.range(1, 10)
.filter((paraCadaUno: any) => paraCadaUno % 2 === 0 )
.toArray();
}
}
if my host, active enableProdMode()
no problem but in plunker This works without error, in Plunker not activated enableProdMode()
Plunker
package.json
"angular2": "2.0.0-beta.7",
"systemjs": "0.19.22",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.5.15"
Maybe this error is related to this response but not how to fix it, or if this is a wrong approach.
Angular2 method binding error: "value has changed after it was checked"