I want to rearrange an object in AngularJS which looks like this:
var persons = [
{socialnum : "123", pname: "Malcom Reynolds"},
{socialnum : "456", pname: "Kaylee Frye"},
{socialnum : "789", pname: "Jayne Cobb"}
];
Result should be like this:
var persons = [
{socialnum : "123", pname: "123 - Malcom Reynolds"},
{socialnum : "456", pname: "456 - Kaylee Frye"},
{socialnum : "789", pname: "789 - Jayne Cobb"}
];
What i tried is this:
angular.forEach(persons , function (key, value) {
this.push(values.socialnum + ' - ' + values.pname);
}, persons );
I did not received the output i wanted