Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

feat(modal): pass reason when opened promise rejected #2978

Closed

Conversation

onjiro
Copy link
Contributor

@onjiro onjiro commented Nov 17, 2014

Pass rejected reason on opened promise rejected, like $routeChangeError event on ngRoute.
Give chance to handle error depends on rejected reason on opened promise.

@januswel
Copy link

I agree with onjiro.
This change might be able to handle the reason about rejection with "opened", like below.

$modal.open({
    templateUrl: 'myModalContent.html',
    controller: 'ModalInstanceCtrl',
    resolve: {
        resources: ['$resource', function ($resource) {
            return $resource('/my/resources').get().$promise;
        }]
    }
}).opened.catch(function (errorResult) {
    $window.alert(errorResult.statusText);
});

I think this is very useful.

@18601673727
Copy link

Useful 👍

@wesleycho
Copy link
Contributor

Thanks, this was a good catch!

@januswel
Copy link

thx, wesleycho!!

fernando-sendMail pushed a commit to fernando-sendMail/bootstrap that referenced this pull request Jul 9, 2015
fernando-sendMail pushed a commit to fernando-sendMail/bootstrap that referenced this pull request Jul 16, 2015
fernando-sendMail pushed a commit to fernando-sendMail/bootstrap that referenced this pull request Jul 16, 2015
fernando-sendMail pushed a commit to fernando-sendMail/bootstrap that referenced this pull request Jul 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants