I have a case where I need to ask for confirmation on deleting data in Angular, I did it with this (along with Angular UI Bootstrap):
$scope.delete = (id) ->
$scope.setId = id //here the $scope.setId is 543
$modal.open
templateUrl: 'deleteModalContent.html'
controller: modalInstanceController
modalInstanceController = ['$scope', '$modalInstance', ($scope, $modalInstance) ->
$scope.delete_ok = ->
console.log $scope.setId //here the value becomes undefined
$scope.delete_cancel = ->
$modalInstance.dismiss 'cancel'
]
As I have stated my problem in the code (on the comment), the id becomes undefined in different controller, without $rootscope, how can I get around this?