Reputation: 674
I have a page, let me call it "Basic Page" where I call modal
. In this modal I do something and after I close the modal I should reload the data of "Basic Page".
How are this two scopes related with each other and what is the solution of this problem?
EDIT
Here is the function that makes the change in the modal:
$scope.sendFunction = function() {
var file = $scope.files[0];
$scope.upload = $upload.upload({
url: '/api/upload',
method: 'POST',
data: {date: date, comment: comment},
file: file
}).success(function(data, status, headers, config) {
$scope.cancel();
userSvc.getUserMedia(account.id, account.accessToken).
then(function(result) {
$scope.accountRecentMedia = result.data;
userSvc.getUserFutureMedia(account.username, userInfo.accessToken).
then(function(result) {
$scope.accountFutureMedia = result;
console.log($scope.accountFutureMedia);
}, function (error) {
console.log(error);
});
}, function (error) {
console.log(error);
});
});
};
Upvotes: 1
Views: 6164
Reputation: 174
This might help:
var modalInstance = $modal.open({templateUrl: 'views/scenarios/addconditiondialog.html',
controller: newConditionController,
windowClass: 'windowmodal',
resolve: {
somstuff: function () {
return "something to resolve before calling controller";
},
}
});
modalInstance.result.then(function(condition) {
});
See also the angular ui modal docs:
The open method returns a modal instance, an object with the following properties:
close(result) - a method that can be used to close a modal, passing a result dismiss(reason) - a method that can be used to dismiss a modal, passing a reason result - a promise that is resolved when a modal is closed and rejected when a modal is dismissed opened - a promise that is resolved when a modal gets opened after downloading content's template and resolving all variables
Upvotes: 3