I'm using AngularJS 1.3 and ngDialog 0.5.9
Opening the dialog using the code similar to this:
function openDialog() {
$scope.dataToPassToDialog = myData;
var dialog = ngDialog.open({
template: 'template.html',
className: 'ngdialog-theme-default',
scope: $scope,
});
dialog.closePromise.then(function (data) {
});
}
I have a small form in the dialog and I need to pass that data back when user closes the dialog. Inside dialog controller I'm closing it using :
ngDialog.close();
I need to pass a data object back from dialog to calling controller, I can't find anything in documentation, I tried
ngDialog.close(myDataFromDialog);
but I can't access it in any way.
How can I do it?
create $scope.myDataFromDialog in your controller
and use it in the dialog
you can find an example in the documentation:
https://github.com/likeastore/ngDialog