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

$modalInstance.close(result) throws exception "Cannot read property 'value' of undefined" #2325

Closed
coolaj86 opened this issue Jun 10, 2014 · 5 comments

Comments

@coolaj86
Copy link

I have a login modal that I close upon successful login and then immediately open the update account modal. When the update account modal is closed, it throws the exception:

Cannot read property 'value' of undefined
    function showLoginModal() {

      return $modal.open({
        templateUrl: '/views/login.html'
      , controller: 'LoginCtrl as L'
      , backdrop: 'static'
      , resolve: {
          mySession: function (Session) {
            return Session.get();
          }
        }
      }).result.then(function () {
        return $timeout(function () {
          console.log('trying with a timeout');
          return $modal.open({
            templateUrl: '/views/account-new.html'
          , controller: 'AccountNewCtrl as A'
          , backdrop: 'static'
          , resolve: {
              mySession: function (Session) {
                return Session.get();
              }
            }
          }).result;
        });
      });
    }

After some user interaction and http requests this is called as per usual in the AccountNewCtrl:

$modalInstance.close(result)
@pkozlowski-opensource
Copy link
Member

@coolaj86 we won't be able to assist you without a minimal reproduce scenario using http://plnkr.co/

@c-johnson
Copy link

I have the same problem, created a Plunker to demonstrate:

http://plnkr.co/edit/XYMudaGtoP6eFaKS6IUK

@koenweyn
Copy link

koenweyn commented Jul 3, 2014

This happens when you try to close a dialog that has already been closed.
In your example @c-johnson, you don't keep track of dismissal of the dialog: http://plnkr.co/edit/XrjNiZ?p=preview.
In any case, a 'double close' shouldn't throw an error

@koenweyn
Copy link

koenweyn commented Jul 3, 2014

Apparently, this issue has already been logged and fixed: #1972.
But there's no official release containing the fix yet.

@antoinepairet
Copy link

Closing as it is fixed by #1972

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants