{"version":3,"sources":["webpack:///webpack/bootstrap b2938a098e2d498408cb","webpack:///./src/angular-modal-service.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;AChCC,cAAW;;AAEV;;AAEA,OAAI,SAAS,QAAQ,MAAR,CAAe,qBAAf,EAAsC,EAAtC,CAAb;;AAEA,UAAO,OAAP,CAAe,cAAf,EAA+B,CAAC,UAAD,EAAa,WAAb,EAA0B,UAA1B,EAAsC,aAAtC,EAAqD,OAArD,EAA8D,YAA9D,EAA4E,IAA5E,EAAkF,kBAAlF,EAAsG,UAAtG,EAC7B,UAAS,QAAT,EAAmB,SAAnB,EAA8B,QAA9B,EAAwC,WAAxC,EAAqD,KAArD,EAA4D,UAA5D,EAAwE,EAAxE,EAA4E,gBAA5E,EAA8F,QAA9F,EAAwG;;AAExG,cAAS,YAAT,GAAwB;;AAEtB,WAAI,OAAO,IAAX;;;;;AAKA,WAAI,cAAc,SAAd,WAAc,CAAS,QAAT,EAAmB,WAAnB,EAAgC;AAChD,aAAI,WAAW,GAAG,KAAH,EAAf;AACA,aAAI,QAAJ,EAAc;AACZ,oBAAS,OAAT,CAAiB,QAAjB;AACD,UAFD,MAEO,IAAI,WAAJ,EAAiB;AACtB,4BAAiB,WAAjB,EAA8B,IAA9B,EACG,IADH,CACQ,UAAS,QAAT,EAAmB;AACvB,sBAAS,OAAT,CAAiB,QAAjB;AACD,YAHH,EAGK,UAAS,KAAT,EAAgB;AACjB,sBAAS,MAAT,CAAgB,KAAhB;AACD,YALH;AAMD,UAPM,MAOA;AACL,oBAAS,MAAT,CAAgB,gDAAhB;AACD;AACD,gBAAO,SAAS,OAAhB;AACD,QAfD;;;;;AAoBA,WAAI,cAAc,SAAd,WAAc,CAAS,MA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kKD,EAxKA,GAAD,C","file":"angular-modal-service.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap b2938a098e2d498408cb\n **/","// 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', ['$animate', '$document', '$compile', '$controller', '$http', '$rootScope', '$q', '$templateRequest', '$timeout',\n function($animate, $document, $compile, $controller, $http, $rootScope, $q, $templateRequest, $timeout) {\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 $templateRequest(templateUrl, true)\n .then(function(template) {\n deferred.resolve(template);\n }, function(error) {\n deferred.reject(error);\n });\n } else {\n deferred.reject(\"No template or templateUrl has been specified.\");\n }\n return deferred.promise;\n };\n\n // Adds an element to the DOM as the last child of its container\n // like append, but uses $animate to handle animations. Returns a\n // promise that is resolved once all animation is complete.\n var appendChild = function(parent, child) {\n var children = parent.children();\n if (children.length > 0) {\n return $animate.enter(child, parent, children[children.length - 1]);\n }\n return $animate.enter(child, parent);\n };\n\n self.showModal = function(options) {\n\n // Get the body of the document, we'll add the modal to this.\n var body = angular.element($document[0].body);\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 // 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 = (options.scope || $rootScope).$new();\n var rootScopeOnClose = $rootScope.$on('$locationChangeSuccess', cleanUpClose);\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 closedDeferred = $q.defer();\n var inputs = {\n $scope: modalScope,\n close: function(result, delay) {\n if (delay === undefined || delay === null) delay = 0;\n $timeout(function() {\n\n cleanUpClose(result);\n\n }, delay);\n }\n };\n\n // If we have provided any inputs, pass them to the controller.\n if (options.inputs) angular.extend(inputs, options.inputs);\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(template);\n var modalElement = linkFn(modalScope);\n inputs.$element = modalElement;\n\n // Create the controller, explicitly specifying the scope to use.\n var controllerObjBefore = modalScope[options.controllerAs];\n var modalController = $controller(options.controller, inputs, false, options.controllerAs);\n\n if (options.controllerAs && controllerObjBefore) {\n angular.extend(modalController, controllerObjBefore);\n }\n\n // Finally, append the modal to the dom.\n if (options.appendElement) {\n // append to custom append element\n appendChild(options.appendElement, modalElement);\n } else {\n // append to body when no custom append element is specified\n appendChild(body, 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 closed: closedDeferred.promise\n };\n\n // ...which is passed to the caller via the promise.\n deferred.resolve(modal);\n\n function cleanUpClose(result) {\n\n // Resolve the 'close' promise.\n closeDeferred.resolve(result);\n\n // Let angular remove the element and wait for animations to finish.\n $animate.leave(modalElement)\n .then(function () {\n // Resolve the 'closed' promise.\n closedDeferred.resolve(result);\n\n // We can now clean up the scope\n modalScope.$destroy();\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 });\n\n // remove event watcher\n rootScopeOnClose && rootScopeOnClose();\n }\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\n\n\n/** WEBPACK FOOTER **\n ** ./src/angular-modal-service.js\n **/"],"sourceRoot":""}