Ionic Ion-list retrieve value after clicking

Hi

I try to get the value after clicking on an item; this list is contained in a pop up (see Template below). Here is the code.

$scope.listdata = [
{id:1, content:‘restaurant 1’, value:‘1’},
{id:2, content:‘restaurant 2’, value:‘2’},
{id:3, content:‘restaurant 3’, value:‘3’},
{id:4, content:‘restaurant 4’, value:‘4’},
{id:5, content:‘restaurant 5’, value:‘5’}
];

var listPopup = $ionicPopup.confirm({
template: ’ ‘+
{{item.content}}’+
’ ',
title: ‘Afficher les commerces’,
scope: $scope,
buttons: [{
text: ‘Yes’,
type: ‘button-positive’,
onTap: function (e) {
console.log($scope.item.model);
}
}, {
text: ‘Cancel’,
type: ‘button-default’,
}]
});

Normally with ng-model i can retrieve the data properly but it doesn’t work there; I just want to display the item chosen in the console.log.

Any help is welcome.

Alex

Hi!, You can use Promises to help you, like:

var listPopup = $ionicPopup.confirm(yourObject);

listPopup.then(function(res){console.log(res)})