0

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"

Community
  • 1
  • 1
Angel Angel
  • 19,670
  • 29
  • 79
  • 105
  • How can I reproduce the error? The plunker works fine for me. – Günter Zöchbauer Mar 06 '16 at 16:37
  • @GünterZöchbauer I can not, the fact is that, I went to put the error in the plunker to make it easier to see error described, but I realized that in the plunker worked well, no error. So I put the information of the my package.json, maybe that influenced? – Angel Angel Mar 06 '16 at 16:43
  • @GünterZöchbauer in my host I can see -> test: 2 test: 4 test: 6 test: 8 test: 10 | but on the console I get the error that I put up – Angel Angel Mar 06 '16 at 16:51
  • 2
    @GünterZöchbauer some time later I resolved, delete Angular2 and rxjs, I will actualize and copy it worked, maybe was working on somewhere that was not updated correctly, in Angular2 or rxjs, I have no idea, but maybe helps someone with an error similar. Thanks for your time. – Angel Angel Mar 06 '16 at 18:14
  • 2
    Great, thanks for reporting back. – Günter Zöchbauer Mar 06 '16 at 18:54

0 Answers0