From beb2c50f346296f082a6194b8fa9ea940c9f7848 Mon Sep 17 00:00:00 2001 From: Dave Kerr Date: Fri, 20 Mar 2015 22:48:33 +0100 Subject: [PATCH] Replaced 'catch' with 'then(null, err)' to support IE8. Fixes #21 --- CHANGELOG.md | 5 +++++ bower.json | 2 +- dst/angular-modal-service.js | 10 ++++------ dst/angular-modal-service.min.js | 4 ++-- dst/angular-modal-service.min.js.map | 2 +- package.json | 2 +- src/angular-modal-service.js | 5 ++--- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2375f2c..b8b8186 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/bower.json b/bower.json index d86cb05..8c8ecd4 100644 --- a/bower.json +++ b/bower.json @@ -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)" diff --git a/dst/angular-modal-service.js b/dst/angular-modal-service.js index 11e6ce1..edf8cd7 100644 --- a/dst/angular-modal-service.js +++ b/dst/angular-modal-service.js @@ -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); }); } @@ -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) { @@ -150,7 +148,7 @@ deferred.resolve(modal); }) - .catch(function(error) { + .then(null, function(error) { // 'catch' doesn't work in IE8. deferred.reject(error); }); diff --git a/dst/angular-modal-service.min.js b/dst/angular-modal-service.min.js index ce7e145..4b2d4b0 100644 --- a/dst/angular-modal-service.min.js +++ b/dst/angular-modal-service.min.js @@ -1,3 +1,3 @@ -/*angular-modal-service v0.6.4 - https://github.com/dwmkerr/angular-modal-service */ -!function(){"use strict";var e=angular.module("angularModalService",[]);e.factory("ModalService",["$document","$compile","$controller","$http","$rootScope","$q","$templateCache",function(e,n,t,o,l,r,c){function a(){var e=this,a=function(e,n){var t=r.defer();if(e)t.resolve(e);else if(n){var l=c.get(n);void 0!==l?t.resolve(l):o({method:"GET",url:n,cache:!0}).then(function(e){c.put(n,e.data),t.resolve(e.data)})["catch"](function(e){t.reject(e)})}else t.reject("No template or templateUrl has been specified.");return t.promise};e.showModal=function(e){var o=r.defer(),c=e.controller;return c?(e.controllerAs&&(c=c+" as "+e.controllerAs),a(e.template,e.templateUrl).then(function(a){var u=l.$new(),s=r.defer(),p={$scope:u,close:function(e,n){(void 0===n||null===n)&&(n=0),window.setTimeout(function(){s.resolve(e),u.$destroy(),h.remove(),p.close=null,o=null,s=null,$=null,p=null,h=null,u=null},n)}};if(e.inputs)for(var d in e.inputs)p[d]=e.inputs[d];var f=angular.element(a),m=t(c,p),v=n(f),h=v(u);p.$element=h,e.appendElement?e.appendElement.append(h):i.append(h);var $={controller:m,scope:u,element:h,close:s.promise};o.resolve($)})["catch"](function(e){o.reject(e)}),o.promise):(o.reject("No controller has been specified."),o.promise)}}var i=e.find("body");return new a}])}(); +/*angular-modal-service v0.6.6 - https://github.com/dwmkerr/angular-modal-service */ +!function(){"use strict";var e=angular.module("angularModalService",[]);e.factory("ModalService",["$document","$compile","$controller","$http","$rootScope","$q","$templateCache",function(e,n,l,t,o,r,a){function c(){var e=this,c=function(e,n){var l=r.defer();if(e)l.resolve(e);else if(n){var o=a.get(n);void 0!==o?l.resolve(o):t({method:"GET",url:n,cache:!0}).then(function(e){a.put(n,e.data),l.resolve(e.data)},function(e){l.reject(e)})}else l.reject("No template or templateUrl has been specified.");return l.promise};e.showModal=function(e){var t=r.defer(),a=e.controller;return a?(e.controllerAs&&(a=a+" as "+e.controllerAs),c(e.template,e.templateUrl).then(function(c){var u=o.$new(),s=r.defer(),p={$scope:u,close:function(e,n){(void 0===n||null===n)&&(n=0),window.setTimeout(function(){s.resolve(e),u.$destroy(),m.remove(),p.close=null,t=null,s=null,$=null,p=null,m=null,u=null},n)}};if(e.inputs)for(var d in e.inputs)p[d]=e.inputs[d];var f=angular.element(c),v=n(f),m=v(u);p.$element=m;var h=l(a,p);e.appendElement?e.appendElement.append(m):i.append(m);var $={controller:h,scope:u,element:m,close:s.promise};t.resolve($)}).then(null,function(e){t.reject(e)}),t.promise):(t.reject("No controller has been specified."),t.promise)}}var i=e.find("body");return new c}])}(); //# sourceMappingURL=angular-modal-service.min.js.map \ No newline at end of file diff --git a/dst/angular-modal-service.min.js.map b/dst/angular-modal-service.min.js.map index 49bddc0..e97aa0e 100644 --- a/dst/angular-modal-service.min.js.map +++ b/dst/angular-modal-service.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["angular-modal-service.js"],"names":["module","angular","factory","$document","$compile","$controller","$http","$rootScope","$q","$templateCache","ModalService","self","this","getTemplate","template","templateUrl","deferred","defer","resolve","cachedTemplate","get","undefined","method","url","cache","then","result","put","data","error","reject","promise","showModal","options","controllerName","controller","controllerAs","modalScope","$new","closeDeferred","inputs","$scope","close","delay","window","setTimeout","$destroy","modalElement","remove","modal","inputName","modalElementTemplate","element","modalController","linkFn","$element","appendElement","append","body","scope","find"],"mappings":"CAMC,WAEC,YAEA,IAAIA,GAASC,QAAQD,OAAO,yBAE5BA,GAAOE,QAAQ,gBAAiB,YAAa,WAAY,cAAe,QAAS,aAAc,KAAM,iBACnG,SAASC,EAAWC,EAAUC,EAAaC,EAAOC,EAAYC,EAAIC,GAKlE,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EAAQuB,cAAcC,OAAOV,GAG7BW,EAAKD,OAAOV,EAId,IAAIE,IACFd,WAAYkB,EACZM,MAAOtB,EACPe,QAASL,EACTL,MAAOH,EAAcR,QAIvBf,GAASE,QAAQ+B,KA7ErBpC,SAgFS,SAASgB,GACdb,EAASc,OAAOD,KAGbb,EAASe,UA/Fdf,EAASc,OAAO,qCACTd,EAASe,UA9CtB,GAAI2B,GAAOvD,EAAUyD,KAAK,OAiJ1B,OAAO,IAAIlD","file":"angular-modal-service.min.js","sourcesContent":["// angularModalService.js\r\n//\r\n// Service for showing modal dialogs.\r\n\r\n/***** JSLint Config *****/\r\n/*global angular */\r\n(function() {\r\n\r\n 'use strict';\r\n\r\n var module = angular.module('angularModalService', []);\r\n\r\n module.factory('ModalService', ['$document', '$compile', '$controller', '$http', '$rootScope', '$q', '$templateCache',\r\n function($document, $compile, $controller, $http, $rootScope, $q, $templateCache) {\r\n\r\n // Get the body of the document, we'll add the modal to this.\r\n var body = $document.find('body');\r\n\r\n function ModalService() {\r\n\r\n var self = this;\r\n\r\n // Returns a promise which gets the template, either\r\n // from the template parameter or via a request to the\r\n // template url parameter.\r\n var getTemplate = function(template, templateUrl) {\r\n var deferred = $q.defer();\r\n if(template) {\r\n deferred.resolve(template);\r\n } else if(templateUrl) {\r\n // check to see if the template has already been loaded\r\n var cachedTemplate = $templateCache.get(templateUrl);\r\n if(cachedTemplate !== undefined) {\r\n deferred.resolve(cachedTemplate);\r\n }\r\n // if not, let's grab the template for the first time\r\n else {\r\n $http({method: 'GET', url: templateUrl, cache: true})\r\n .then(function(result) {\r\n // save template into the cache and return the template\r\n $templateCache.put(templateUrl, result.data);\r\n deferred.resolve(result.data);\r\n })\r\n .catch(function(error) {\r\n deferred.reject(error);\r\n });\r\n }\r\n } else {\r\n deferred.reject(\"No template or templateUrl has been specified.\");\r\n }\r\n return deferred.promise;\r\n };\r\n\r\n self.showModal = function(options) {\r\n\r\n // Create a deferred we'll resolve when the modal is ready.\r\n var deferred = $q.defer();\r\n\r\n // Validate the input parameters.\r\n var controllerName = options.controller;\r\n if(!controllerName) {\r\n deferred.reject(\"No controller has been specified.\");\r\n return deferred.promise;\r\n }\r\n\r\n // If a 'controllerAs' option has been provided, we change the controller\r\n // name to use 'as' syntax. $controller will automatically handle this.\r\n if(options.controllerAs) {\r\n controllerName = controllerName + \" as \" + options.controllerAs;\r\n }\r\n\r\n // Get the actual html of the template.\r\n getTemplate(options.template, options.templateUrl)\r\n .then(function(template) {\r\n\r\n // Create a new scope for the modal.\r\n var modalScope = $rootScope.$new();\r\n\r\n // Create the inputs object to the controller - this will include\r\n // the scope, as well as all inputs provided.\r\n // We will also create a deferred that is resolved with a provided\r\n // close function. The controller can then call 'close(result)'.\r\n // The controller can also provide a delay for closing - this is\r\n // helpful if there are closing animations which must finish first.\r\n var closeDeferred = $q.defer();\r\n var inputs = {\r\n $scope: modalScope,\r\n close: function(result, delay) {\r\n if(delay === undefined || delay === null) delay = 0;\r\n window.setTimeout(function() {\r\n // Resolve the 'close' promise.\r\n closeDeferred.resolve(result);\r\n\r\n // We can now clean up the scope and remove the element from the DOM.\r\n modalScope.$destroy();\r\n modalElement.remove();\r\n \r\n // Unless we null out all of these objects we seem to suffer\r\n // from memory leaks, if anyone can explain why then I'd \r\n // be very interested to know.\r\n inputs.close = null;\r\n deferred = null;\r\n closeDeferred = null;\r\n modal = null;\r\n inputs = null;\r\n modalElement = null;\r\n modalScope = null;\r\n }, delay);\r\n }\r\n };\r\n\r\n // If we have provided any inputs, pass them to the controller.\r\n if(options.inputs) {\r\n for(var inputName in options.inputs) {\r\n inputs[inputName] = options.inputs[inputName];\r\n }\r\n }\r\n\r\n // Parse the modal HTML into a DOM element (in template form).\r\n var modalElementTemplate = angular.element(template);\r\n\r\n // Create the controller, explicitly specifying the scope to use.\r\n var modalController = $controller(controllerName, inputs);\r\n \r\n // Compile then link the template element, building the actual element.\r\n // Set the $element on the inputs so that it can be injected if required.\r\n var linkFn = $compile(modalElementTemplate);\r\n var modalElement = linkFn(modalScope);\r\n inputs.$element = modalElement;\r\n\r\n\r\n // Finally, append the modal to the dom.\r\n if (options.appendElement) {\r\n // append to custom append element\r\n options.appendElement.append(modalElement);\r\n } else {\r\n // append to body when no custom append element is specified\r\n body.append(modalElement);\r\n }\r\n\r\n // We now have a modal object...\r\n var modal = {\r\n controller: modalController,\r\n scope: modalScope,\r\n element: modalElement,\r\n close: closeDeferred.promise\r\n };\r\n\r\n // ...which is passed to the caller via the promise.\r\n deferred.resolve(modal);\r\n\r\n })\r\n .catch(function(error) {\r\n deferred.reject(error);\r\n });\r\n\r\n return deferred.promise;\r\n };\r\n\r\n }\r\n\r\n return new ModalService();\r\n }]);\r\n\r\n}());\r\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["angular-modal-service.js"],"names":["module","angular","factory","$document","$compile","$controller","$http","$rootScope","$q","$templateCache","ModalService","self","this","getTemplate","template","templateUrl","deferred","defer","resolve","cachedTemplate","get","undefined","method","url","cache","then","result","put","data","error","reject","promise","showModal","options","controllerName","controller","controllerAs","modalScope","$new","closeDeferred","inputs","$scope","close","delay","window","setTimeout","$destroy","modalElement","remove","modal","inputName","modalElementTemplate","element","linkFn","$element","modalController","appendElement","append","body","scope","find"],"mappings":"CAMC,WAEC,YAEA,IAAIA,GAASC,QAAQD,OAAO,yBAE5BA,GAAOE,QAAQ,gBAAiB,YAAa,WAAY,cAAe,QAAS,aAAc,KAAM,iBACnG,SAASC,EAAWC,EAAUC,EAAaC,EAAOC,EAAYC,EAAIC,GAKlE,QAASC,KAEP,GAAIC,GAAOC,KAKPC,EAAc,SAASC,EAAUC,GACnC,GAAIC,GAAWR,EAAGS,OAClB,IAAGH,EACDE,EAASE,QAAQJ,OACZ,IAAGC,EAAa,CAErB,GAAII,GAAiBV,EAAeW,IAAIL,EAClBM,UAAnBF,EACDH,EAASE,QAAQC,GAIjBb,GAAOgB,OAAQ,MAAOC,IAAKR,EAAaS,OAAO,IAC5CC,KAAK,SAASC,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A+I1B,OAAO,IAAIlD","file":"angular-modal-service.min.js","sourcesContent":["// angularModalService.js\n//\n// Service for showing modal dialogs.\n\n/***** JSLint Config *****/\n/*global angular */\n(function() {\n\n 'use strict';\n\n var module = angular.module('angularModalService', []);\n\n module.factory('ModalService', ['$document', '$compile', '$controller', '$http', '$rootScope', '$q', '$templateCache',\n function($document, $compile, $controller, $http, $rootScope, $q, $templateCache) {\n\n // Get the body of the document, we'll add the modal to this.\n var body = $document.find('body');\n\n function ModalService() {\n\n var self = this;\n\n // Returns a promise which gets the template, either\n // from the template parameter or via a request to the\n // template url parameter.\n var getTemplate = function(template, templateUrl) {\n var deferred = $q.defer();\n if(template) {\n deferred.resolve(template);\n } else if(templateUrl) {\n // check to see if the template has already been loaded\n var cachedTemplate = $templateCache.get(templateUrl);\n if(cachedTemplate !== undefined) {\n deferred.resolve(cachedTemplate);\n }\n // if not, let's grab the template for the first time\n else {\n $http({method: 'GET', url: templateUrl, cache: true})\n .then(function(result) {\n // save template into the cache and return the template\n $templateCache.put(templateUrl, result.data);\n deferred.resolve(result.data);\n }, function(error) {\n deferred.reject(error);\n });\n }\n } else {\n deferred.reject(\"No template or templateUrl has been specified.\");\n }\n return deferred.promise;\n };\n\n self.showModal = function(options) {\n\n // Create a deferred we'll resolve when the modal is ready.\n var deferred = $q.defer();\n\n // Validate the input parameters.\n var controllerName = options.controller;\n if(!controllerName) {\n deferred.reject(\"No controller has been specified.\");\n return deferred.promise;\n }\n\n // If a 'controllerAs' option has been provided, we change the controller\n // name to use 'as' syntax. $controller will automatically handle this.\n if(options.controllerAs) {\n controllerName = controllerName + \" as \" + options.controllerAs;\n }\n\n // Get the actual html of the template.\n getTemplate(options.template, options.templateUrl)\n .then(function(template) {\n\n // Create a new scope for the modal.\n var modalScope = $rootScope.$new();\n\n // Create the inputs object to the controller - this will include\n // the scope, as well as all inputs provided.\n // We will also create a deferred that is resolved with a provided\n // close function. The controller can then call 'close(result)'.\n // The controller can also provide a delay for closing - this is\n // helpful if there are closing animations which must finish first.\n var closeDeferred = $q.defer();\n var inputs = {\n $scope: modalScope,\n close: function(result, delay) {\n if(delay === undefined || delay === null) delay = 0;\n window.setTimeout(function() {\n // Resolve the 'close' promise.\n closeDeferred.resolve(result);\n\n // We can now clean up the scope and remove the element from the DOM.\n modalScope.$destroy();\n modalElement.remove();\n \n // Unless we null out all of these objects we seem to suffer\n // from memory leaks, if anyone can explain why then I'd \n // be very interested to know.\n inputs.close = null;\n deferred = null;\n closeDeferred = null;\n modal = null;\n inputs = null;\n modalElement = null;\n modalScope = null;\n }, delay);\n }\n };\n\n // If we have provided any inputs, pass them to the controller.\n if(options.inputs) {\n for(var inputName in options.inputs) {\n inputs[inputName] = options.inputs[inputName];\n }\n }\n\n // Parse the modal HTML into a DOM element (in template form).\n var modalElementTemplate = angular.element(template);\n\n // Compile then link the template element, building the actual element.\n // Set the $element on the inputs so that it can be injected if required.\n var linkFn = $compile(modalElementTemplate);\n var modalElement = linkFn(modalScope);\n inputs.$element = modalElement;\n\n // Create the controller, explicitly specifying the scope to use.\n var modalController = $controller(controllerName, inputs);\n\n // Finally, append the modal to the dom.\n if (options.appendElement) {\n // append to custom append element\n options.appendElement.append(modalElement);\n } else {\n // append to body when no custom append element is specified\n body.append(modalElement);\n }\n\n // We now have a modal object...\n var modal = {\n controller: modalController,\n scope: modalScope,\n element: modalElement,\n close: closeDeferred.promise\n };\n\n // ...which is passed to the caller via the promise.\n deferred.resolve(modal);\n\n })\n .then(null, function(error) { // 'catch' doesn't work in IE8.\n deferred.reject(error);\n });\n\n return deferred.promise;\n };\n\n }\n\n return new ModalService();\n }]);\n\n}());\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/package.json b/package.json index 1718b13..679667c 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/angular-modal-service.js b/src/angular-modal-service.js index d316f22..edf8cd7 100644 --- a/src/angular-modal-service.js +++ b/src/angular-modal-service.js @@ -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); }); } @@ -149,7 +148,7 @@ deferred.resolve(modal); }) - .catch(function(error) { + .then(null, function(error) { // 'catch' doesn't work in IE8. deferred.reject(error); });