I have response from my API in an array which looks like this ["email","email"]. I want to use the data to map to values in a checkbox so that I could use the value to send email to selected checkbox contacts.
How can I tackle this?
if($stateParams.nonExists){
console.log($stateParams.nonExists)
$scope.nonExists = $stateParams.nonExists
}
if($stateParams.data){
return $q(function(resolve,reject){
$http.get('/google/contacts?code='+$stateParams.data).
success(function(res){
if(res && res.length){
resolve(res)
console.log(res);
}
})
})
.then(function(emails){
$http.post('/user/import/exists',{emails:_.pluck(emails,'address')}).
success(function(data){
$scope.existUsers = data.data.exists
$scope.nonExists = data.data.nonExists
})
})
}
This is the code in my controller. My problem is the data from the http request is in array like ['[email protected], [email protected]] and I want to use those array values into checkbox to send emails to them