I am using angular bootstrap UI for modal pop up. My requirement is that when user clicks on "delete" link,first modal pop should open and when user click ok then delete rest API is called which is used to delete record. But for that I need to pass record id to my delete function. So how can I pass record id to modal insta controller as I am calling this function when user click ok button on modal pop up. Here is my code.
`$scope.items = ['item1', 'item2', 'item3'];
$scope.open = function (size,billingID) {
console.log("in model instance" + billingID);
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
size: size,
resolve: {
items: function () {
return $scope.items;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
console.log("in model instance result" + billingID + selectedItem );
}, function () {
$log.info('Modal dismissed at: ' + new Date());
console.log('Modal dismissed at: ' + new Date() );
});
};
var ModalInstanceCtrl = function ($scope, $modalInstance, items) {
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.billingID=billingID;
$scope.ok = function ( billingID) {
$modalInstance.close($scope.selected.item);
deleteCC(billingID);
};
$scope.cancel = function () {
console.log("in model instance cancel");
$modalInstance.dismiss('cancel');
};
};
`
I am able to obtain my billing id in open()But how can I access same building id in my ModalInstanceCtrl ?