circlingthesun / angular-foundation-6

Foundation 6 directives for Angular 1.5+
http://circlingthesun.github.io/angular-foundation-6/
Other
95 stars 50 forks source link

Cannot open modal: "Possibly unhandled rejection: undefined" #65

Closed Kukiwon closed 7 years ago

Kukiwon commented 7 years ago

When I try to open a modal I get the following error in the console:

Possibly unhandled rejection: undefined

Here's the code that I'm using:

var params = {
    templateUrl: 'my-modal.html',
    controller: function($scope) {
    }
};

var modalInstance = $modal.open(params);
modalInstance.result.then(function() {
    $log.info('All good');
}, function() {
    $log.info('Modal dismissed at: ' + new Date());
});

Note that when I take out the $scope parameter in the controller, no error is produced and the modal shows.

var params = {
    templateUrl: 'my-modal.html',
    controller: function() {
    }
};

I'm using Angular version 1.6.5.

Kukiwon commented 7 years ago

I just found out that the error was unrelated to this lib and that this lib has only been tested with Angular 1.5.x.

circlingthesun commented 7 years ago

Yeah, I'm aware of this. Because the promise associated with the modal is cancelled when the modal is dismissed, angular 1.6's error handling will catch that and make a fuss if you don't handle it. It still works, its just a bit annoying.