I have a popup with list of options “radio” i can’t bind the value of the option to the controller where am building item object
.
Am getting in the console Tapped! undefined
my controller code
.controller('newItemCtrl', function($scope, $http, $ionicPopup) {
$scope.item = {
title: $scope.title,
price: $scope.price,
desc: $scope.description,
picture: $scope.picture
};
$scope.list = [{
id: 1,
title: 'Women clothes'
}, {
id: 2,
title: 'Men clothes'
}, {
id: 3,
title: 'Restaurant & Lounge'
}, {
id: 4,
title: 'Accessories'
}, {
id: 5,
title: 'Digital gadgets'
}, ];
$scope.addFromList = function() {
$scope.item = {}
var myPopup = $ionicPopup.show({
templateUrl: 'templates/cat-opitions.html',
title: 'Select',
scope: $scope,
buttons: [{
text: 'Ok',
type: 'button sharb-border white-font blue-bg-alt border-blue-alt',
onTap: function() {
return $scope.item.category;
}
}]
});
myPopup.then(function(res) {
console.log('Tapped!', res);
});
};
})
The popup template:
<label class="item item-radio" ng-repeat="item in list">
<input type="radio" name="group" ng-model="item.category" ng-value="item.title">
<div class="item-content">{{ item.title }}</div>
<i class="radio-icon ion-checkmark"></i>
</label>