Reputation: 6397
I am using PDFSharp in my project. I need to open a modal after it saves the document. The function to open the modal is in a Angular controller. How would I do this?
WebApi Controller
// Save the document...
const string filename = @"C:\Users\texas_000\Desktop\TexasExterior\TexasExterior\JobSetupPdfs\HelloWorld.pdf";
document.Save(filename);
// ...and start a viewer.
// Process.Start(filename);
}
catch (Exception ex)
{
Debug.Print(ex.ToString());
}
return string.Empty;
Function to open Modal
$scope.PrintPreviewModal = function () {
$ekathuwa.modal({
id: "PrintPreviewModal", contentStyle: "width:800px;heigth:400px",
scope: $scope,
templateURL: "ModalPrintPreview"
});
}
Upvotes: 0
Views: 78
Reputation: 2865
I'm assuming you know how to make API calls from your angular app.
After you make your api call and it returns, you want to execute $scope.PrintPreviewModal()
If you are using promises you will want to do this in the Success function that is executed when you get a 200 response code back. I hope this helps.
$scope.save = function () {
save(params, success, error); //api call to save doc
};
var success = function () {
$scope.PrintPreviewModal(); //open modal
};
var error = function () {
//do something
};
Upvotes: 1
Reputation: 1315
I don't know exactly how you're calling off to the WebApi controller, but I'd imagine (since you're using Angular) you're using Angular's $http
service.
If so, just open the modal on the promise success
at the end of the call:
$http.get('/SaveTheDocumentWebApiAction').success(function (){
$scope.PrintPreviewModal();
});
Upvotes: 0