I'm attempting to use dialogService.open to open a custom dialog and then access the information submitted by the user. The problem I'm seeing is that the data variable returned to the callback function isn't getting any data.
Here is the function being called in my controller:
angular.module("umbraco").controller("Com.Bisk.CustomController", function ($scope, $timeout, dialogService) {
$scope.setImage = function(imageUrl){
dialogService.open({
showDetails: true,
template: '../App_Plugins/MyPlugin/mycustomdialog.html',
show: true,
callback: function (data) {
$scope.control.value = {
// data coming back as 'undefined'
altText: data.altText
};
}
});
};
}
Values entered in the dialog aren't automatically sent back to your original view, so you need to call something like $scope.submit(data). That should give you a value in your callback function ;)
You could also listen for events to get your data back
MainWindow controller:
// listening for an ItemDeleted event to happen
$scope.$on('ItemDeleted', function (event, args) {
console.log('id to delete: ' + args.idToDelete);
$scope.reloadBookingList();
});
In your dialog controller:
shouldDelete = confirm('Are you sure you want to delete this item?');
if (shouldDelete) {
bookingResource.deleteBooking(id);
notificationsService.success("System message", "item deleted");
// broadcasting event - passing data back to MainWindow
$rootScope.$broadcast('ItemDeleted', { idToDelete: id });
dialogService.closeAll();
}
question on how to use dialogService.open
Greetings:
I'm attempting to use dialogService.open to open a custom dialog and then access the information submitted by the user. The problem I'm seeing is that the data variable returned to the callback function isn't getting any data.
Here is the function being called in my controller:
Here is my view:
Hi John,
How does the view of your dialog look?
Values entered in the dialog aren't automatically sent back to your original view, so you need to call something like
$scope.submit(data)
. That should give you a value in your callback function ;)You could also listen for events to get your data back
MainWindow controller:
In your dialog controller:
Simon and Anders: thank you both! It turns out I just needed to add the correct ng-model attributes and then submit(my-model-name).
is working on a reply...