0

I have this code like this:

$scope.role.object_access_right = {contact:1,group:1,image:1,text:1,email_template:1,email:1,channel:1,campaign:1,invoice:1,user:1,account:1,tenant:1,}

I have empty array here,

$scope.access = [];

How can I push the key to empty array to have result ?

 $scope.access = [contact,group,text ...]
trai bui
  • 588
  • 12
  • 36

1 Answers1

6
$scope.access = Object.keys($scope.role.object_access_right);

That should do the trick.

ಠ_ಠ
  • 3,060
  • 28
  • 43
  • thanks and more question,I want to get value and use: $scope.access = Object.values($scope.role.object_access_right); but it not work for me ? – trai bui Jul 09 '14 at 09:19