I'm i bit stuck with function which is assigned to the $scope variable.
need to wait until it's finished.
This is the function assigned to $scope variable:
$scope.ChooseHome = function() {
ModalWindowService.openChooseHomeDialog($scope);
}
in ModalWindowService I have:
function openChooseHomeDialog($scope) {
$scope.animationsEnabled = true;
var modalInstance = $modal.open({
animation: $scope.animationsEnabled,
templateUrl: '/view/user/ChooseHomeDialog.html',
controller: 'chooseHomeDialogController',
windowClass: 'detail-modal-window'
});
modalInstance.result.then(function (CondoID) {
$scope.choosenCondoID = CondoID;
});
}
what I want to do is properly receive this variable '$scope.choosenCondoID' after I get it from modal in '$scope.ChooseHome' function and do some work with it.
smth like this options:
$scope.ChooseHome = function() {
ModalWindowService.openChooseHomeDialog($scope).then(*do my stuff*); /
ModalWindowService.openChooseHomeDialog($scope).success(*do my stuff*);
}
But it's not working, I'm getting errors like this:
'TypeError: (intermediate value).success is not a function'