material icon indicating copy to clipboard operation
material copied to clipboard

$mdDialog.hide cannot pass more than 1 parameter to promise

Open alanpurple opened this issue 10 years ago • 3 comments

$mdDialog.show({
                controller: editNewsDlgController,
                templateUrl: '/admin/partials/dialogs/editNewsDlg.html',
                locals: {
                    isNew: false,
                    news: $scope.newsList[index]
                },
                clickOutsideToClose: true
            })
            .then(function (result, update, newPhoto) {
                console.log(result); // true
                console.log(update); // undefined
                console.log(newPhoto); // undefined

console.log('only photo hide');  // hit, printed
$mdDialog.hide(true, null, true);

alanpurple avatar Dec 21 '15 11:12 alanpurple

You could temporarily solve this by creating an object with all three of those params values and passing them through:

result:{
       result: result,
       update: update,
       newPhoto: newPhoto,
}

$mdDialog.hide(result);

.then(function(result){
        console.log(result.result, result.update, result.newPhoto)
});

EsunaProxy avatar Dec 21 '15 18:12 EsunaProxy

Yeah I temporarily solved it already, thx On Dec 22, 2015 3:30 AM, "EsunaProxy" [email protected] wrote:

You could temporarily solve this by creating an object with all three of those params values and passing them through:

result:{ result: result, update: update, newPhoto: newPhoto, }

$mdDialog.hide(result);

.then(function(result){ console.log(result.result, result.update, result.newPhoto) });

— Reply to this email directly or view it on GitHub https://github.com/angular/material/issues/6413#issuecomment-166383151.

alanpurple avatar Dec 21 '15 18:12 alanpurple

This issue is closed as part of our deprecation effort. For details, see our post Spring Cleaning 2016.

ThomasBurleson avatar Apr 28 '16 19:04 ThomasBurleson