var testNavigation = function() { if ($scope.selections.somethingChanged) { var modal = $modal.open({ controller: function ($scope) { $scope.okClass = 'btn-primary', $scope.okLabel = resourceFactory.getResource('Labels', 'yes'), $scope.cancelLabel = resourceFactory.getResource('Labels', 'cancel'), $scope.title = resourceFactory.getResource('Labels', 'unsavedChanges'), $scope.message = resourceFactory.getResource('Messages', 'unsavedChanges'); }, templateUrl: '/app/templates/modal' }); modal.result.then(function () { $scope.selections.somethingChanged = false; return false; }); } } $scope.loadView = function (guest) { testNavigation(); if ($scope.selections.somethingChanged) { return false; } more code hereThe problem is that the execution is not sequential, e.g. it passes testNavigation, goes down to return false and after that I see my modal dialog. So, even if I answer 'Yes' on that question my new row is not loaded. So, I am now dealing with the asynchronous nature of the code. I am very close, can you see what I need to change in the above to make it work?