index.js
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.data =[{"Id":1,"Title":"en-US","Description":"UnitedStates","MyValues":[{"demo":"dish","Id":100,"Value":"Save"}]},
{"Id":1,"Title":"en-UK","Description":"UK","MyValues":[{"demo":"Myvalu","Id":102,"Value":"Delete"}]}]
$scope.cols = Object.keys($scope.data[0]);
$scope.notSorted = function(obj){
if (!obj) {
return [];
}
return Object.keys(obj);
}
});
I want to check in $scope.data
is there any column value as array/collection in above code MyValues
is a array/collection
, I tried using angular.isArray(value)
but it does not work.
You can use this check Array.isArray([1,2,3])
$scope.data.map(function(obj){
return Object.keys(obj).filter(function(k){
return Array.isArray(obj[k]);
});
});
The code above will give you all the lists for each element in the Array of $scope.data ,, do you want a specific format ??