0
{"13":"I","14":"E","15":"V","16":"G"}

to:

['I', 'E', 'V', 'G']

where the 0 property of objects have the array of 1 and 2 objects? Is there a way to do that?

<div ng-repeat="data in data" >
<label>
<input ng-model="student[data.stn_id]"  ng-true-value="'{{data.stn_name}}'" ng-false-value="" /><span>{{data.stn_name}}</span>
                            </label>
                        </div>
                       {{student}}

Thanks

1
  • Not clear. Put more details Commented Dec 27, 2016 at 11:35

3 Answers 3

1

Using underscorejs

var d={"13":"I","14":"E","15":"V","16":"G"};
_.values(d);
Sign up to request clarification or add additional context in comments.

Comments

0
var x = {"13":"I","14":"E","15":"V","16":"G"};

var result = [];
angular.forEach(x, function (value, key){
    result.push(value);
});

console.log(result); // [I,E,V,G]

4 Comments

Didn't get that. It should work. What's the issue ? Are you getting any error ?
NO, I AM GET ANY ERROR MY OUT IS COME IN OBJECT BUT I GET DATA IN ARRAY
Sorry but I could not understand what you are trying to say. Can you please make your question clear. Just mention the data you are getting from service and to which form it should be converted.
thank you for replay and ans me :var result = []; angular.forEach(x, function (element) { result.push(element); }); return x.join(','); console.log(result);
0
        var a = {"13":"I", "14":"E", "15":"V", "16":"G"};
        var b = [];
        angular.forEach(a, function(val, key){
          b.push(val);
        })
        console.log(b); // check the output ['I', 'E', 'V', 'G']

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.