blob: c126df993e5fcb6b30af4d60f6905b39029d5924 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
redirectorApp.controller('DeleteRedirectCtrl', ['$scope', function($s) {
// Ok, this is pretty ugly. But I want to make this controller to control
// everything about the deleting process, so I make this available on
// the parent scope, so the RedirectListCtrl can access it.
$s.$parent.confirmDeleteRedirect = function(index) {
$s.redirect = $s.redirects[index];
$s.deleteIndex = index;
$s.$parent.showDeleteForm = true;
};
$s.cancelDelete = function(index) {
delete $s.redirect;
delete $s.deleteIndex;
$s.$parent.showDeleteForm = false;
}
$s.deleteRedirect = function() {
$s.redirects.splice($s.deleteIndex, 1);
delete $s.redirect;
delete $s.deleteIndex;
$s.$parent.showDeleteForm = false;
$s.saveChanges();
};
}]);
|