Hi Sander,

Yes, you're right, this is what I got. However, here is my code:

this.bundleService.getBundles().subscribe((bundlesArray: Array<Bundle>) => {
console.log("*** Got bundles:", bundlesArray);
console.log("*** Types:", typeof bundlesArray, Array.isArray(bundlesArray));
for (let bundle of bundlesArray) {
console.log("*** Got bundle", bundle);
this.bundles.push({label: bundle.label, value: {codePk: bundle.codePk, 
label: bundle.label, isActive: bundle.isActive}});
}
             ...
So, I have an array of objects of type Bundle. The first log statement 
correctly displays the content of the array, something like:

*** Got bundles: {bundles: Array(7)}.

   1. {codePk: "DynamicBundle", label: "DynamicBundle", isActive: "1"}
   2. 1:{codePk: "IsoLanguage", label: "Iso Languages", isActive: "1"}
   3. 2:{codePk: "Test_Bundle", label: "Test_Bundle", isActive: "1"}
   4. 3:{codePk: "TranscludeBundles", label: "Transclude bundles for tests"
   , isActive: "1"}
   5. 4:{codePk: "TranscludedBundle1", label: "Transcluded bundle 1", 
   isActive: "1"}
   6. 5:{codePk: "TranscludedBundle2", label: "Transcluded bundle 2", 
   isActive: "1"}
   7. 6:{codePk: "TranscludedBundle1a", label: "Transcluded bundle 1a", 
   isActive: "1"}

 The 2nd log statement displays, as a matter of fact, 

*** Types: object false

and the last log statement is never executed as if the array were empty.

What should I conclude from all this ? My array is not an array or the for 
... of loop is not meant to be used in this case ?

Many thanks in advance,

Nicolas

Le mardi 22 août 2017 04:27:18 UTC+2, Sander Elias a écrit :
>
> Hi Nicolas,
>
> I don't think your 'myArray' is an actual array. I suspect it's a object. 
> check it out by logging the following:
>
> console.log(typeOf myArray, Array.isArray(myArray))
>
> I suspect the answer will be 'object, false'
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" 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.

Reply via email to