Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-modal-service

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-modal-service - npm Package Compare versions

Comparing version 0.14.1 to 0.14.2

.circleci/config.yml

268

dst/angular-modal-service.js

@@ -1,266 +0,2 @@

/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {
'use strict';
var _module = angular.module('angularModalService', []);
_module.factory('ModalService', ['$animate', '$document', '$compile', '$controller', '$http', '$rootScope', '$q', '$templateRequest', '$timeout', function ($animate, $document, $compile, $controller, $http, $rootScope, $q, $templateRequest, $timeout) {
function ModalService() {
var self = this;
// Track open modals.
self.openModals = [];
// Returns a promise which gets the template, either
// from the template parameter or via a request to the
// template url parameter.
var getTemplate = function getTemplate(template, templateUrl) {
var deferred = $q.defer();
if (template) {
deferred.resolve(template);
} else if (templateUrl) {
$templateRequest(templateUrl, true).then(function (template) {
deferred.resolve(template);
}, function (error) {
deferred.reject(error);
});
} else {
deferred.reject("No template or templateUrl has been specified.");
}
return deferred.promise;
};
// Adds an element to the DOM as the last child of its container
// like append, but uses $animate to handle animations. Returns a
// promise that is resolved once all animation is complete.
var appendChild = function appendChild(parent, child) {
var children = parent.children();
if (children.length > 0) {
return $animate.enter(child, parent, children[children.length - 1]);
}
return $animate.enter(child, parent);
};
// Close all modals, providing the given result to the close promise.
self.closeModals = function (result, delay) {
while (self.openModals.length) {
self.openModals[0].close(result, delay);
self.openModals.splice(0, 1);
}
};
self.showModal = function (options) {
// Get the body of the document, we'll add the modal to this.
var body = angular.element($document[0].body);
// Create a deferred we'll resolve when the modal is ready.
var deferred = $q.defer();
// Validate the input parameters.
var controllerName = options.controller;
if (!controllerName) {
deferred.reject("No controller has been specified.");
return deferred.promise;
}
// Get the actual html of the template.
getTemplate(options.template, options.templateUrl).then(function (template) {
// The main modal object we will build.
var modal = {};
// Create a new scope for the modal.
var modalScope = (options.scope || $rootScope).$new(),
rootScopeOnClose = null,
locationChangeSuccess = options.locationChangeSuccess;
// Allow locationChangeSuccess event registration to be configurable.
// True (default) = event registered immediately
// # (greater than 0) = event registered with delay
// False = disabled
if (locationChangeSuccess === false) {
rootScopeOnClose = angular.noop;
} else if (angular.isNumber(locationChangeSuccess) && locationChangeSuccess >= 0) {
$timeout(function () {
rootScopeOnClose = $rootScope.$on('$locationChangeSuccess', cleanUpClose);
}, locationChangeSuccess);
} else {
rootScopeOnClose = $rootScope.$on('$locationChangeSuccess', cleanUpClose);
}
// Create the inputs object to the controller - this will include
// the scope, as well as all inputs provided.
// We will also create a deferred that is resolved with a provided
// close function. The controller can then call 'close(result)'.
// The controller can also provide a delay for closing - this is
// helpful if there are closing animations which must finish first.
var closeDeferred = $q.defer();
var closedDeferred = $q.defer();
var inputs = {
$scope: modalScope,
close: function close(result, delay) {
// If we have a pre-close function, call it.
if (typeof options.preClose === 'function') options.preClose(modal, result, delay);
if (delay === undefined || delay === null) delay = 0;
$timeout(function () {
cleanUpClose(result);
}, delay);
}
};
// If we have provided any inputs, pass them to the controller.
if (options.inputs) angular.extend(inputs, options.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(template);
var modalElement = linkFn(modalScope);
inputs.$element = modalElement;
// Create the controller, explicitly specifying the scope to use.
var controllerObjBefore = modalScope[options.controllerAs];
var modalController = $controller(options.controller, inputs, false, options.controllerAs);
if (options.controllerAs && controllerObjBefore) {
angular.extend(modalController, controllerObjBefore);
}
// Then, append the modal to the dom.
if (options.appendElement) {
// append to custom append element
appendChild(options.appendElement, modalElement);
} else {
// append to body when no custom append element is specified
appendChild(body, modalElement);
}
// Finally, append any custom classes to the body
if (options.bodyClass) {
body[0].classList.add(options.bodyClass);
}
// Populate the modal object...
modal.controller = modalController;
modal.scope = modalScope;
modal.element = modalElement;
modal.close = closeDeferred.promise;
modal.closed = closedDeferred.promise;
// ...which is passed to the caller via the promise.
deferred.resolve(modal);
// Clear previous input focus to avoid open multiple modals on enter
document.activeElement.blur();
// We can track this modal in our open modals.
self.openModals.push({ modal: modal, close: inputs.close });
function cleanUpClose(result) {
// Resolve the 'close' promise.
closeDeferred.resolve(result);
// Remove the custom class from the body
if (options.bodyClass) {
body[0].classList.remove(options.bodyClass);
}
// Let angular remove the element and wait for animations to finish.
$animate.leave(modalElement).then(function () {
// prevent error if modal is already destroyed
if (!modalElement) {
return;
}
// Resolve the 'closed' promise.
closedDeferred.resolve(result);
// We can now clean up the scope
modalScope.$destroy();
// Remove the modal from the set of open modals.
for (var i = 0; i < self.openModals.length; i++) {
if (self.openModals[i].modal === modal) {
self.openModals.splice(i, 1);
break;
}
}
// Unless we null out all of these objects we seem to suffer
// from memory leaks, if anyone can explain why then I'd
// be very interested to know.
inputs.close = null;
deferred = null;
closeDeferred = null;
modal = null;
inputs = null;
modalElement = null;
modalScope = null;
});
// remove event watcher
rootScopeOnClose && rootScopeOnClose();
}
}).then(null, function (error) {
// 'catch' doesn't work in IE8.
deferred.reject(error);
});
return deferred.promise;
};
}
return new ModalService();
}]);
/***/ }
/******/ ]);
//# sourceMappingURL=angular-modal-service.js.map
!function(e){var n={};function o(t){if(n[t])return n[t].exports;var l=n[t]={i:t,l:!1,exports:{}};return e[t].call(l.exports,l,l.exports,o),l.l=!0,l.exports}o.m=e,o.c=n,o.d=function(e,n,t){o.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,n){if(1&n&&(e=o(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(o.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var l in e)o.d(t,l,function(n){return e[n]}.bind(null,l));return t},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="",o(o.s=0)}([function(e,n,o){"use strict";angular.module("angularModalService",[]).factory("ModalService",["$animate","$document","$compile","$controller","$http","$rootScope","$q","$templateRequest","$timeout",function(e,n,o,t,l,r,c,u,a){return new function(){var l=this;l.openModals=[];var s=function(n,o){var t=n.children();return t.length>0?e.enter(o,n,t[t.length-1]):e.enter(o,n)};l.closeModals=function(e,n){for(;l.openModals.length;)l.openModals[0].close(e,n),l.openModals.splice(0,1)},l.showModal=function(i){var p=angular.element(n[0].body),d=c.defer();return i.controller?(function(e,n){var o=c.defer();return e?o.resolve(e):n?u(n,!0).then(function(e){o.resolve(e)},function(e){o.reject(e)}):o.reject("No template or templateUrl has been specified."),o.promise}(i.template,i.templateUrl).then(function(n){var u={},f=(i.scope||r).$new(),m=null,v=i.locationChangeSuccess;!1===v?m=angular.noop:angular.isNumber(v)&&v>=0?a(function(){m=r.$on("$locationChangeSuccess",S)},v):m=r.$on("$locationChangeSuccess",S);var b=c.defer(),g=c.defer(),y=!1,h={$scope:f,close:function(e,n){"function"==typeof i.preClose&&i.preClose(u,e,n),void 0!==n&&null!==n||(n=0),y||(y=!0,a(function(){S(e)},n))}};i.inputs&&angular.extend(h,i.inputs);var $=o(n)(f);h.$element=$;var M=f[i.controllerAs],j=t(i.controller,h,!1,i.controllerAs);function S(n){b.resolve(n),i.bodyClass&&p[0].classList.remove(i.bodyClass),e.leave($).then(function(){if($){g.resolve(n),f.$destroy();for(var e=0;e<l.openModals.length;e++)if(l.openModals[e].modal===u){l.openModals.splice(e,1);break}h.close=null,d=null,b=null,u=null,h=null,$=null,f=null}}),m&&m()}i.controllerAs&&M&&angular.extend(j,M),i.appendElement?s(i.appendElement,$):s(p,$),i.bodyClass&&p[0].classList.add(i.bodyClass),u.controller=j,u.scope=f,u.element=$,u.close=b.promise,u.closed=g.promise,d.resolve(u),document.activeElement.blur(),l.openModals.push({modal:u,close:h.close})}).then(null,function(e){d.reject(e)}),d.promise):(d.reject("No controller has been specified."),d.promise)}}}])}]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vc3JjL2FuZ3VsYXItbW9kYWwtc2VydmljZS5qcyJdLCJuYW1lcyI6WyJpbnN0YWxsZWRNb2R1bGVzIiwiX193ZWJwYWNrX3JlcXVpcmVfXyIsIm1vZHVsZUlkIiwiZXhwb3J0cyIsIm1vZHVsZSIsImkiLCJsIiwibW9kdWxlcyIsImNhbGwiLCJtIiwiYyIsImQiLCJuYW1lIiwiZ2V0dGVyIiwibyIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZW51bWVyYWJsZSIsImdldCIsInIiLCJTeW1ib2wiLCJ0b1N0cmluZ1RhZyIsInZhbHVlIiwidCIsIm1vZGUiLCJfX2V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7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vICBMZXQgYW5ndWxhciByZW1vdmUgdGhlIGVsZW1lbnQgYW5kIHdhaXQgZm9yIGFuaW1hdGlvbnMgdG8gZmluaXNoLlxuICAgICAgICAgICAgJGFuaW1hdGUubGVhdmUobW9kYWxFbGVtZW50KVxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgLy8gcHJldmVudCBlcnJvciBpZiBtb2RhbCBpcyBhbHJlYWR5IGRlc3Ryb3llZFxuICAgICAgICAgICAgICAgICAgICAgIGlmICghbW9kYWxFbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgLy8gIFJlc29sdmUgdGhlICdjbG9zZWQnIHByb21pc2UuXG4gICAgICAgICAgICAgICAgICAgICAgY2xvc2VkRGVmZXJyZWQucmVzb2x2ZShyZXN1bHQpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgLy8gIFdlIGNhbiBub3cgY2xlYW4gdXAgdGhlIHNjb3BlXG4gICAgICAgICAgICAgICAgICAgICAgbW9kYWxTY29wZS4kZGVzdHJveSgpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgLy8gIFJlbW92ZSB0aGUgbW9kYWwgZnJvbSB0aGUgc2V0IG9mIG9wZW4gbW9kYWxzLlxuICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGk9MDsgaTxzZWxmLm9wZW5Nb2RhbHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZWxmLm9wZW5Nb2RhbHNbaV0ubW9kYWwgPT09IG1vZGFsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYub3Blbk1vZGFscy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgIC8vICBVbmxlc3Mgd2UgbnVsbCBvdXQgYWxsIG9mIHRoZXNlIG9iamVjdHMgd2Ugc2VlbSB0byBzdWZmZXJcbiAgICAgICAgICAgICAgICAgICAgICAvLyAgZnJvbSBtZW1vcnkgbGVha3MsIGlmIGFueW9uZSBjYW4gZXhwbGFpbiB3aHkgdGhlbiBJJ2RcbiAgICAgICAgICAgICAgICAgICAgICAvLyAgYmUgdmVyeSBpbnRlcmVzdGVkIHRvIGtub3cuXG4gICAgICAgICAgICAgICAgICAgICAgaW5wdXRzLmNsb3NlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZCA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgICAgY2xvc2VEZWZlcnJlZCA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgICAgbW9kYWwgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICAgIGlucHV0cyA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgICAgbW9kYWxFbGVtZW50ID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICBtb2RhbFNjb3BlID0gbnVsbDtcblxuICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAvLyByZW1vdmUgZXZlbnQgd2F0Y2hlclxuICAgICAgICAgICAgcm9vdFNjb3BlT25DbG9zZSAmJiByb290U2NvcGVPbkNsb3NlKCk7XG4gICAgICAgICAgfVxuXG4gICAgICAgIH0pXG4gICAgICAgIC50aGVuKG51bGwsIGZ1bmN0aW9uKGVycm9yKSB7IC8vICdjYXRjaCcgZG9lc24ndCB3b3JrIGluIElFOC5cbiAgICAgICAgICBkZWZlcnJlZC5yZWplY3QoZXJyb3IpO1xuICAgICAgICB9KTtcblxuICAgICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG4gICAgfTtcblxuICB9XG5cbiAgcmV0dXJuIG5ldyBNb2RhbFNlcnZpY2UoKTtcbn1dKTtcbiJdLCJzb3VyY2VSb290IjoiIn0=

@@ -1,2 +0,1 @@

!function(e){function o(l){if(n[l])return n[l].exports;var t=n[l]={exports:{},id:l,loaded:!1};return e[l].call(t.exports,t,t.exports,o),t.loaded=!0,t.exports}var n={};o.m=e,o.c=n,o.p="",o(0)}([function(e,o){"use strict";angular.module("angularModalService",[]).factory("ModalService",["$animate","$document","$compile","$controller","$http","$rootScope","$q","$templateRequest","$timeout",function(e,o,n,l,t,r,s,a,c){function u(){var t=this;t.openModals=[];var u=function(e,o){var n=s.defer();return e?n.resolve(e):o?a(o,!0).then(function(e){n.resolve(e)},function(e){n.reject(e)}):n.reject("No template or templateUrl has been specified."),n.promise},i=function(o,n){var l=o.children();return l.length>0?e.enter(n,o,l[l.length-1]):e.enter(n,o)};t.closeModals=function(e,o){for(;t.openModals.length;)t.openModals[0].close(e,o),t.openModals.splice(0,1)},t.showModal=function(a){var p=angular.element(o[0].body),d=s.defer();return a.controller?(u(a.template,a.templateUrl).then(function(o){function u(o){$.resolve(o),a.bodyClass&&p[0].classList.remove(a.bodyClass),e.leave(C).then(function(){if(C){g.resolve(o),m.$destroy();for(var e=0;e<t.openModals.length;e++)if(t.openModals[e].modal===f){t.openModals.splice(e,1);break}M.close=null,d=null,$=null,f=null,M=null,C=null,m=null}}),v&&v()}var f={},m=(a.scope||r).$new(),v=null,h=a.locationChangeSuccess;h===!1?v=angular.noop:angular.isNumber(h)&&h>=0?c(function(){v=r.$on("$locationChangeSuccess",u)},h):v=r.$on("$locationChangeSuccess",u);var $=s.defer(),g=s.defer(),M={$scope:m,close:function(e,o){"function"==typeof a.preClose&&a.preClose(f,e,o),void 0!==o&&null!==o||(o=0),c(function(){u(e)},o)}};a.inputs&&angular.extend(M,a.inputs);var b=n(o),C=b(m);M.$element=C;var y=m[a.controllerAs],x=l(a.controller,M,!1,a.controllerAs);a.controllerAs&&y&&angular.extend(x,y),a.appendElement?i(a.appendElement,C):i(p,C),a.bodyClass&&p[0].classList.add(a.bodyClass),f.controller=x,f.scope=m,f.element=C,f.close=$.promise,f.closed=g.promise,d.resolve(f),document.activeElement.blur(),t.openModals.push({modal:f,close:M.close})}).then(null,function(e){d.reject(e)}),d.promise):(d.reject("No controller has been specified."),d.promise)}}return new u}])}]);
//# sourceMappingURL=./dst/angular-modal-service.min.js.map
!function(o){var t={};function r(e){if(t[e])return t[e].exports;var n=t[e]={i:e,l:!1,exports:{}};return o[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=o,r.c=t,r.d=function(e,n,o){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var t in n)r.d(o,t,function(e){return n[e]}.bind(null,t));return o},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="",r(r.s=0)}([function(e,n,o){"use strict";angular.module("angularModalService",[]).factory("ModalService",["$animate","$document","$compile","$controller","$http","$rootScope","$q","$templateRequest","$timeout",function(y,t,h,$,e,M,j,r,S){return new function(){var b=this;b.openModals=[];var g=function(e,n){var o=e.children();return 0<o.length?y.enter(n,e,o[o.length-1]):y.enter(n,e)};b.closeModals=function(e,n){for(;b.openModals.length;)b.openModals[0].close(e,n),b.openModals.splice(0,1)},b.showModal=function(f){var e,n,o,m=angular.element(t[0].body),v=j.defer();return f.controller?(e=f.template,n=f.templateUrl,o=j.defer(),e?o.resolve(e):n?r(n,!0).then(function(e){o.resolve(e)},function(e){o.reject(e)}):o.reject("No template or templateUrl has been specified."),o.promise).then(function(e){var o={},t=(f.scope||M).$new(),r=null,n=f.locationChangeSuccess;!1===n?r=angular.noop:angular.isNumber(n)&&0<=n?S(function(){r=M.$on("$locationChangeSuccess",d)},n):r=M.$on("$locationChangeSuccess",d);var l=j.defer(),c=j.defer(),a=!1,s={$scope:t,close:function(e,n){"function"==typeof f.preClose&&f.preClose(o,e,n),null!=n||(n=0),a||(a=!0,S(function(){d(e)},n))}};f.inputs&&angular.extend(s,f.inputs);var u=h(e)(t);s.$element=u;var i=t[f.controllerAs],p=$(f.controller,s,!1,f.controllerAs);function d(n){l.resolve(n),f.bodyClass&&m[0].classList.remove(f.bodyClass),y.leave(u).then(function(){if(u){c.resolve(n),t.$destroy();for(var e=0;e<b.openModals.length;e++)if(b.openModals[e].modal===o){b.openModals.splice(e,1);break}s.close=null,t=u=s=o=l=v=null}}),r&&r()}f.controllerAs&&i&&angular.extend(p,i),f.appendElement?g(f.appendElement,u):g(m,u),f.bodyClass&&m[0].classList.add(f.bodyClass),o.controller=p,o.scope=t,o.element=u,o.close=l.promise,o.closed=c.promise,v.resolve(o),document.activeElement.blur(),b.openModals.push({modal:o,close:s.close})}).then(null,function(e){v.reject(e)}):v.reject("No controller has been specified."),v.promise}}}])}]);
{
"name": "angular-modal-service",
"version": "0.14.1",
"version": "0.14.2",
"description": "AngularJS Service for showing Modals and Popups",
"main": "./index.js",
"scripts": {
"build": "webpack && uglifyjs ./dst/angular-modal-service.js --compress --mangle -o ./dst/angular-modal-service.min.js --source-map ./dst/angular-modal-service.min.js.map",
"build": "webpack --mode=production && uglifyjs ./dst/angular-modal-service.js --compress --mangle -o ./dst/angular-modal-service.min.js --source-map",
"start": "webpack-dev-server --inline --content-base ./samples",
"test": "karma start karma.config.js",
"test-debug": "karma start karma.config.js --no-single-run --browsers Chrome",
"coveralls": "cp build/coverage/PhantomJS*/lcov.info lcov.info && node node_modules/coveralls/bin/coveralls.js < lcov.info"
"test": "karma start --single-run --browsers ChromeHeadless karma.conf.js",
"test-debug": "karma start --no-single-run --browsers ChromeHeadless karma.conf.js"
},

@@ -30,23 +29,25 @@ "repository": {

"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"angular": "1.6.x",
"angular-mocks": "1.6.x",
"babel-core": "^6.9.1",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.9.0",
"coveralls": "^3.0.0",
"isparta-loader": "^2.0.0",
"jasmine-core": "^2.4.1",
"jshint-stylish": "^2.0.0",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage": "~1.1.1",
"karma-jasmine": "~1.1.1",
"babel-loader": "^8.0.4",
"chai": "^4.2.0",
"istanbul-instrumenter-loader": "^3.0.1",
"karma": "^2.0.5",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-coverage-istanbul-reporter": "^2.0.4",
"karma-junit-reporter": "2.0.x",
"karma-phantomjs-launcher": "1.0.x",
"karma-mocha": "^1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.9",
"phantomjs-prebuilt": "2.1.x",
"mocha": "^5.2.0",
"sinon": "^7.0.0",
"uglify-js": "^3.3.9",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
}
}
# angular-modal-service
[![Build Status](https://secure.travis-ci.org/dwmkerr/angular-modal-service.png?branch=master)](https://travis-ci.org/dwmkerr/angular-modal-service)
[![Coverage Status](https://coveralls.io/repos/dwmkerr/angular-modal-service/badge.png?branch=master)](https://coveralls.io/r/dwmkerr/angular-modal-service?branch=master)
[![CircleCI](https://circleci.com/gh/dwmkerr/angular-modal-service.svg?style=shield)](https://circleci.com/gh/dwmkerr/angular-modal-service)
[![codecov](https://codecov.io/gh/dwmkerr/angular-modal-service/branch/master/graph/badge.svg)](https://codecov.io/gh/dwmkerr/angular-modal-service)
[![Dependencies](https://david-dm.org/dwmkerr/angular-modal-service.svg?theme=shields.io)](https://david-dm.org/dwmkerr/angular-modal-service)

@@ -257,3 +257,3 @@ [![Dev Dependencies](https://david-dm.org/dwmkerr/angular-modal-service/dev-status.svg?theme=shields.io)](https://david-dm.org/dwmkerr/angular-modal-service#info=devDependencies)

- Use `npm version` to bump, e.g. `npm version patch`
- Push and deploy `git push --follow-tags && npm deploy`
- Push and deploy `git push --follow-tags && npm publish`

@@ -260,0 +260,0 @@ ## FAQ

@@ -108,2 +108,4 @@ 'use strict';

var closedDeferred = $q.defer();
var hasAlreadyBeenClosed = false;
var inputs = {

@@ -116,2 +118,7 @@ $scope: modalScope,

if (delay === undefined || delay === null) delay = 0;
if (hasAlreadyBeenClosed) {
return;
}
hasAlreadyBeenClosed = true;
$timeout(function() {

@@ -118,0 +125,0 @@

@@ -13,5 +13,5 @@ describe('basics', function() {

it('should be able to inject the modal service', () => {
expect(ModalService).not.toBeNull();
expect(ModalService).not.to.equal(null);
});
});
});

@@ -39,3 +39,3 @@ describe('bodyclass', () => {

// We should be able to find the custom class on the body.
expect($document.find('body')[0].classList.contains('custom-class')).toBe(true);
expect($document.find('body')[0].classList.contains('custom-class')).to.equal(true);
});

@@ -57,7 +57,7 @@

// We should be able to find the custom class on the body.
expect($document.find('body')[0].classList.contains('custom-class')).toBe(true);
expect($document.find('body')[0].classList.contains('custom-class')).to.equal(true);
modal.close.then(result => {
// The custom class should have been removed after closing.
expect($document.find('body')[0].classList.contains('custom-class')).toBe(false);
expect($document.find('body')[0].classList.contains('custom-class')).to.equal(false);
});

@@ -72,2 +72,2 @@

});
});

@@ -34,3 +34,3 @@ describe('closeAll', () => {

}).then((modal) => {
modal.close.then((result) => { expect(result).toBe('closeModals'); });
modal.close.then((result) => { expect(result).to.equal('closeModals'); });
}).then(() => {

@@ -42,3 +42,3 @@ // Open another...

}).then((modal) => {
modal.close.then((result) => { expect(result).toBe('closeModals'); });
modal.close.then((result) => { expect(result).to.equal('closeModals'); });
});

@@ -45,0 +45,0 @@ }).then(() => {

@@ -58,3 +58,3 @@ describe('controller', () => {

// the scope, this is how we test it's been passed.
expect(modal.scope.close).not.toBeUndefined();
expect(modal.scope.close).not.to.equal(undefined);

@@ -81,4 +81,4 @@ });

// The controller sets the inputs on the scope.
expect(modal.scope.input1).toBe(15);
expect(modal.scope.input2).toBe("hi");
expect(modal.scope.input1).to.equal(15);
expect(modal.scope.input2).to.equal("hi");

@@ -102,7 +102,7 @@ });

// The controller should be on the scope.
expect(modal.scope.futurama).not.toBeNull();
expect(modal.scope.futurama).not.to.equal(null);
// Fields defined on the controller instance should be on the
// controller on the scope.
expect(modal.scope.futurama.character).toBe('Fry');
expect(modal.scope.futurama.character).to.equal('Fry');

@@ -127,4 +127,4 @@ });

expect(modal.scope).not.toBeNull();
expect(modal.scope.character).toBe('Fry');
expect(modal.scope).not.to.equal(null);
expect(modal.scope.character).to.equal('Fry');

@@ -150,7 +150,7 @@ });

// The controller should be on the scope.
expect(modal.scope.futurama).not.toBeNull();
expect(modal.scope.futurama).not.to.equal(null);
// Fields defined on the controller instance should be on the
// controller on the scope.
expect(modal.scope.futurama.character).toBe('Fry');
expect(modal.scope.futurama.character).to.equal('Fry');

@@ -170,3 +170,3 @@ });

controller: ['$http', function ($http) {
expect($http).not.toBeNull();
expect($http).not.to.equal(null);
this.character = "Fry";

@@ -179,7 +179,7 @@ }],

// The controller should be on the scope.
expect(modal.scope.futurama).not.toBeNull();
expect(modal.scope.futurama).not.to.equal(null);
// Fields defined on the controller instance should be on the
// controller on the scope.
expect(modal.scope.futurama.character).toBe('Fry');
expect(modal.scope.futurama.character).to.equal('Fry');

@@ -202,3 +202,3 @@ });

// The controller should be on the scope.
expect(modal.scope.getElement()).not.toBeUndefined();
expect(modal.scope.getElement()).not.to.equal(undefined);

@@ -220,4 +220,4 @@ });

}).then((modal) => {
expect(modal.scope.formCtrl.ExampleForm).not.toBeUndefined();
expect(modal.scope.formCtrl.checkValidity()).toBe(true);
expect(modal.scope.formCtrl.ExampleForm).not.to.equal(undefined);
expect(modal.scope.formCtrl.checkValidity()).to.equal(true);
});

@@ -224,0 +224,0 @@

@@ -40,3 +40,3 @@ describe('dom', () => {

// We should be able to find the element that has been created in the dom.
expect(document.getElementById('template1')).not.toBeNull();
expect(document.getElementById('template1')).not.to.equal(null);

@@ -57,3 +57,3 @@ });

// insert fakeDomElement into the document to test against
document.body.insertBefore(fakeDomElement);
document.body.insertBefore(fakeDomElement, null);

@@ -66,3 +66,3 @@ ModalService.showModal({

// We should be able to find the lement that has been created in the custom dom element
expect(angular.element(document.querySelector('#fake-dom-element')).find('div')).not.toBeNull();
expect(angular.element(document.querySelector('#fake-dom-element')).find('div')).not.to.equal(null);
});

@@ -81,3 +81,3 @@

// insert fakeDomElement into the document to test against
document.body.insertBefore(fakeDomElement);
document.body.insertBefore(fakeDomElement, null);

@@ -90,6 +90,6 @@ ModalService.showModal({

// We should be able to find the lement that has been created in the custom dom element
expect(angular.element(document.querySelector('#fake-dom-element')).find('div')).not.toBeNull();
expect(angular.element(document.querySelector('#fake-dom-element')).find('div')).not.to.equal(null);
modal.close.then((result) => {
expect(document.getElementById('template2')).toBeNull();
expect(document.getElementById('template2')).to.equal(null);
});

@@ -114,6 +114,6 @@

// We should be able to find the element that has been created in the dom.
expect(document.getElementById('template2')).not.toBeNull();
expect(document.getElementById('template2')).not.to.equal(null);
modal.closed.then((result) => {
expect(document.getElementById('template2')).toBeNull();
expect(document.getElementById('template2')).to.equal(null);
});

@@ -139,6 +139,6 @@

// We should be able to find the element that has been created in the dom.
expect(document.getElementById('template2')).not.toBeNull();
expect(document.getElementById('template2')).not.to.equal(null);
modal.close.then((result) => {
expect(document.getElementById('template2')).toBeNull();
expect(document.getElementById('template2')).to.equal(null);
});

@@ -164,6 +164,6 @@

// We should be able to find the element that has been created in the dom.
expect(document.getElementById('template2')).not.toBeNull();
expect(document.getElementById('template2')).not.to.equal(null);
modal.close.then((result) => {
expect(document.getElementById('template2')).toBeNull();
expect(document.getElementById('template2')).to.equal(null);
});

@@ -190,3 +190,3 @@

// We should be able to find the element that has been created in the dom.
expect(document.getElementById('template2')).not.toBeNull();
expect(document.getElementById('template2')).not.to.equal(null);

@@ -196,3 +196,3 @@ $rootScope.$emit('$locationChangeSuccess');

setTimeout(() => {
expect(document.getElementById('template2')).not.toBeNull();
expect(document.getElementById('template2')).not.to.equal(null);
done();

@@ -218,8 +218,8 @@ }, 3);

$rootScope.$emit('$locationChangeSuccess');
expect($timeout.verifyNoPendingTasks).toThrow();
expect(document.getElementById('template2')).not.toBeNull();
expect($timeout.verifyNoPendingTasks).to.throw();
expect(document.getElementById('template2')).not.to.equal(null);
modal.close.then((result) => {
$timeout.verifyNoPendingTasks();
expect(document.getElementById('template2')).toBeNull();
expect(document.getElementById('template2')).to.equal(null);
});

@@ -226,0 +226,0 @@

@@ -27,6 +27,6 @@ describe('parameters', () => {

// We should never get here!
expect(true).toBe(false);
expect(true).to.equal(false);
done();
}).catch(function(error) {
expect(error).toEqual("No controller has been specified.");
expect(error).to.equal("No controller has been specified.");
done();

@@ -46,6 +46,6 @@ });

// We should never get here!
expect(true).toBe(false);
expect(true).to.equal(false);
done();
}).catch(function(error) {
expect(error).toEqual("No template or templateUrl has been specified.");
expect(error).to.equal("No template or templateUrl has been specified.");
done();

@@ -64,3 +64,3 @@ });

}).then(function(modal) {
expect(modal.element.html()).toBe("A template");
expect(modal.element.html()).to.equal("A template");
done();

@@ -82,3 +82,3 @@ });

}).then(function(modal) {
expect(modal.element.html()).toBe("A template");
expect(modal.element.html()).to.equal("A template");
done();

@@ -85,0 +85,0 @@ });

@@ -0,1 +1,3 @@

var sinon = require('sinon');
describe('template', () => {

@@ -26,2 +28,3 @@

$templateCache.removeAll();
sinon.restore();
}));

@@ -37,3 +40,3 @@

}).then(function(modal) {
expect(modal).not.toBe(null);
expect(modal).not.to.equal(null);
});

@@ -53,3 +56,3 @@

}).catch(function(error) {
expect(error).not.toBe(null);
expect(error).not.to.equal(null);
});

@@ -72,3 +75,3 @@

// The template should now be cached...
spyOn($templateCache, 'get').and.callThrough();
sinon.spy($templateCache, 'get');

@@ -80,4 +83,5 @@ ModalService.showModal({

// ...so get should have been called.
expect(modal).not.toBe(null);
expect($templateCache.get).toHaveBeenCalledWith('templatetobecached.html');
expect(modal).not.to.equal(null);
expect($templateCache.get.called).to.equal(true);
expect($templateCache.get.getCall(0).args[0]).to.equal('templatetobecached.html');
});

@@ -100,3 +104,3 @@

// The template should now be cached...
spyOn($templateCache, 'get').and.callThrough();
sinon.spy($templateCache, 'get');

@@ -108,4 +112,4 @@ ModalService.showModal({

// ...so get should have been called.
expect(modal).not.toBe(null);
expect($templateCache.get).toHaveBeenCalledWith('templatetobeprecached.html');
expect($templateCache.get.called).to.equal(true);
expect($templateCache.get.getCall(0).args[0]).to.equal('templatetobeprecached.html');
});

@@ -112,0 +116,0 @@

@@ -17,3 +17,3 @@ var path = require('path');

// see package.json for details).
devtool: 'source-map',
devtool: 'inline-source-map',

@@ -25,15 +25,17 @@ // Define externals (things we don't pack).

// All JavaScript code goes through the babel loader.
module: {
preLoaders: [{
test: /\.js$/,
exclude: [
path.resolve('node_modules/')
],
loader: 'babel'
}]
},
babel: {
presets: ['es2015']
},
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
}
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc