Safet Susic Safet Susic - 1 year ago 122
AngularJS Question

How to get property name and value from array

so i have object that have many properties, i need to get all values and property names from that object, i'm not sure what is best and easiest way to do it. I already tried few methods but didn't had any luck with it

angular.forEach(array, function(value, key){

Answer Source

forEach works with arrays, for object properties you need:

for (var property in object) {
    if (object.hasOwnProperty(property)) {
        console.log(property, ' ', object[property];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download