Well, it looks like it is because you assign it a string initially, in the class declaration. That later makes the `this.data = data` stringify the array (and if you do a `[].toString()` you get ` '[object Object]'`).
So declare it initially as array: `jobs = [];` - or be explicit about it, so that compiler helps you: `jobs: <any[]> = []`;. That way angular will expect it to be an array right away. You can even specify the type (if you have a Job class): `jobs <Job[]> = [];`. That way you're dead sure angular will get it right. On Sat, Apr 23, 2016 at 4:32 AM, <[email protected]> wrote: > @Zlatko Đurić > > thanks for your help. > > that's right, after log "this.jobs" in subscribe function, it's working > fine. > > but another problem is: > when I use ngFor to loop this.jobs, it also get an error "EXCEPTION: > Cannot find a differ supporting object '[object Object]' of type 'object'. > NgFor only supports binding to Iterables such as Arrays. in [jobs in > JobsComponent@11:12]" > > > I know we use promise to solve this problem in angular1,X, but what about > angular2? > > thanks! > > -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/1jnfzhfmNGk/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- Zlatko -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
