Skip to content

Commit

Permalink
Replaced 'catch' with 'then(null, err)' to support IE8. Fixes #21
Browse files Browse the repository at this point in the history
  • Loading branch information
dwmkerr committed Mar 20, 2015
1 parent 7f5c791 commit beb2c50
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.6.6

* Removed calls to $q `catch` and replaced with `then(null, f)` so that the code works in
IE8 (ECMAScript 3).

## v0.6.5

* Reverted changes below as they led to a bug with injected `$element` in modal controller.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-modal-service",
"version": "0.6.5",
"version": "0.6.6",
"homepage": "https://github.com/dwmkerr/angular-modal-service",
"authors": [
"Dave Kerr (github.com/dwmkerr)"
Expand Down
10 changes: 4 additions & 6 deletions dst/angular-modal-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
// save template into the cache and return the template
$templateCache.put(templateUrl, result.data);
deferred.resolve(result.data);
})
.catch(function(error) {
}, function(error) {
deferred.reject(error);
});
}
Expand Down Expand Up @@ -119,15 +118,14 @@
// Parse the modal HTML into a DOM element (in template form).
var modalElementTemplate = angular.element(template);

// Create the controller, explicitly specifying the scope to use.
var modalController = $controller(controllerName, inputs);

// Compile then link the template element, building the actual element.
// Set the $element on the inputs so that it can be injected if required.
var linkFn = $compile(modalElementTemplate);
var modalElement = linkFn(modalScope);
inputs.$element = modalElement;

// Create the controller, explicitly specifying the scope to use.
var modalController = $controller(controllerName, inputs);

// Finally, append the modal to the dom.
if (options.appendElement) {
Expand All @@ -150,7 +148,7 @@
deferred.resolve(modal);

})
.catch(function(error) {
.then(null, function(error) { // 'catch' doesn't work in IE8.
deferred.reject(error);
});

Expand Down
4 changes: 2 additions & 2 deletions dst/angular-modal-service.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dst/angular-modal-service.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-modal-service",
"version": "0.6.5",
"version": "0.6.6",
"description": "AngularJS Service for showing Modals and Popups",
"main": "./dst/angular-modal-service.js",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/angular-modal-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
// save template into the cache and return the template
$templateCache.put(templateUrl, result.data);
deferred.resolve(result.data);
})
.catch(function(error) {
}, function(error) {
deferred.reject(error);
});
}
Expand Down Expand Up @@ -149,7 +148,7 @@
deferred.resolve(modal);

})
.catch(function(error) {
.then(null, function(error) { // 'catch' doesn't work in IE8.
deferred.reject(error);
});

Expand Down

0 comments on commit beb2c50

Please sign in to comment.