Monday, 15 April 2013

How to join multi arrays from Object properties in Javascript? -



I am using AngularJS and I have a problem below:
I created an object whose Properties are arrays. For example:

  $ scope.myObject = {import: [object1, object2, ..., objectN], export: [object1 ', object2', ... , ObjectN '], ...}  

Now I want to create a new array that includes all the arrays from my object properties, so that I can ng-repeat them with HTML view I can show in
This is my plan sample code:
Please help me. Thank you.

with underscore or call:

  _ _.values ​​($ scope.myObject)); I have also added a plain JS (ECIScript 5+) method:  
  $ Scope.myObjectJS = []; Object. Keys ($ scope.myObject). ForEach (function (key) {$ scope.myObjectJS = $ scope.myObjectJS.concat ($ scope.myObject [key]}};  

The fact is that I have the object . . .

>

No comments:

Post a Comment