I’m using the Angular UI Bootstrap modal to update an array on the scope. I don’t want the changes saved unless I click the close button. If I click the dismiss button I don’t want to update the array. (this is really to try out the modal functionality)
I’m getting a few problems though. When I include $modalInstance in the controller I’m getting the following error: Error: [$injector:unpr] Unknown provider: $modalInstanceProvider <- $modalInstance <- ModalInstanceController This seems similar to AngularJS inject issue with Angular Bootstrap modal but I haven’t got an ng-controller in my template.
The other problem is that when I try and modify the array it’s updated outside of the modal. I’m using $scope.users.push( 'Dave' );
. The official demo seems to be doing it in the same way, so could it be to do with the way I’m passing the scope when I call the open method on $uibModal?
Here’s the Plunk: http://plnkr.co/edit/FuXjSwtljQtFYOtFRV18?p=preview