From e050f53e70041880a66a9b42420471d668a54faf Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 28 Feb 2018 18:09:31 +0500 Subject: [PATCH] Fix bug with modal's event handling --- public/js/controllers/projects/templates.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/js/controllers/projects/templates.js b/public/js/controllers/projects/templates.js index 27b3f529..d30b2d3f 100644 --- a/public/js/controllers/projects/templates.js +++ b/public/js/controllers/projects/templates.js @@ -105,10 +105,12 @@ define(['controllers/projects/taskRunner'], function () { scope.repositories = $scope.repos; scope.environment = $scope.environment; - $modal.open({ + var modal = $modal.open({ templateUrl: '/tpl/projects/templates/add.html', scope: scope - }).result.then(function (opts) { + }); + + modal.result.then(function (opts) { if (opts.remove) { return $scope.remove(template); } @@ -119,7 +121,9 @@ define(['controllers/projects/taskRunner'], function () { }).catch(function (response) { swal('error', 'could not add template:' + response.status, 'error'); }); - }).closed.then(function () { + }); + + modal.closed.then(function () { $scope.reload(); }); }