I am using the following example
https://docs.angularjs.org/api/ng/directive/ngController
in the above mentioned example I have added new button called save. In save I am trying to push all the contacts into an array. Following is my code for Save.
$scope.SaveContact = function () {
var len = $scope.contacts.length;
var contactlist = [];
angular.foreach($scope.contacts, function (value, key) {
contactlist.push( value.type + ':' + key);
}, contactlist);
console.log(contactlist);
};
Please can someone help me solve this.
Try the following
If
value.typeexists you can usethis.push(key + ': ' + value.type);