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.12.1 to 0.12.3

.codacy.yml

6

bower.json
{
"name": "angular-modal-service",
"version": "0.12.1",
"version": "0.12.2",
"homepage": "https://github.com/dwmkerr/angular-modal-service",

@@ -32,7 +32,7 @@ "authors": [

"dependencies": {
"angular": "~1.5.x"
"angular": "1.5.0 - 1.6.x"
},
"devDependencies": {
"angular-mocks": "~1.5.x"
"angular-mocks": "1.5.0 - 1.6.x"
}
}

@@ -0,1 +1,5 @@

## v0.6.12
* When a model is opened, we blur any active element. Thanks [samx](https://github.com/samwx)!
## v0.6.11

@@ -2,0 +6,0 @@

@@ -186,2 +186,5 @@ /******/ (function(modules) { // webpackBootstrap

// Clear previous input focus to avoid open multiple modals on enter
document.activeElement.blur();
// We can track this modal in our open modals.

@@ -188,0 +191,0 @@ self.openModals.push({ modal: modal, close: inputs.close });

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

!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){h.resolve(o),a.bodyClass&&p[0].classList.remove(a.bodyClass),e.leave(b).then(function(){$.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,h=null,f=null,M=null,b=null,m=null}),v&&v()}var f={},m=(a.scope||r).$new(),v=r.$on("$locationChangeSuccess",u),h=s.defer(),$=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 g=n(o),b=g(m);M.$element=b;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,b):i(p,b),a.bodyClass&&p[0].classList.add(a.bodyClass),f.controller=x,f.scope=m,f.element=b,f.close=h.promise,f.closed=$.promise,d.resolve(f),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}])}]);
!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){h.resolve(o),a.bodyClass&&p[0].classList.remove(a.bodyClass),e.leave(b).then(function(){$.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,h=null,f=null,M=null,b=null,m=null}),v&&v()}var f={},m=(a.scope||r).$new(),v=r.$on("$locationChangeSuccess",u),h=s.defer(),$=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 g=n(o),b=g(m);M.$element=b;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,b):i(p,b),a.bodyClass&&p[0].classList.add(a.bodyClass),f.controller=x,f.scope=m,f.element=b,f.close=h.promise,f.closed=$.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
{
"name": "angular-modal-service",
"version": "0.12.1",
"version": "0.12.3",
"description": "AngularJS Service for showing Modals and Popups",

@@ -30,4 +30,4 @@ "main": "./dst/angular-modal-service.js",

"devDependencies": {
"angular": "1.5.x",
"angular-mocks": "1.5.x",
"angular": "1.6.x",
"angular-mocks": "1.6.x",
"babel-core": "^6.9.1",

@@ -34,0 +34,0 @@ "babel-loader": "^6.2.4",

@@ -134,3 +134,3 @@ angular-modal-service

* `controller`: The name of the controller to created. It could be a function.
* `controller`: The name of the controller to create. It could be a function.
* `controllerAs` : The name of the variable on the scope instance of the controller is assigned to - (optional).

@@ -145,3 +145,3 @@ * `templateUrl`: The URL of the HTML template to use for the modal.

* `bodyClass`: Optional. The custom css class to append to the body while the modal is open (optional, useful when not using Bootstrap).
* `preClose`: Optional. A funtion which will be called before the process of closing a modal starts. The signature is `function preClose(modal, result, delay)`. It is provided the `modal` object, the `result` which was passed to `close` and the `delay` which was passed to close.
* `preClose`: Optional. A function which will be called before the process of closing a modal starts. The signature is `function preClose(modal, result, delay)`. It is provided the `modal` object, the `result` which was passed to `close` and the `delay` which was passed to close.

@@ -152,3 +152,3 @@ #### The Modal Object

* `modal.element` - The DOM element created. This is a jquery lite object (or jquery if full
* `modal.element` - The created DOM element. This is a jquery lite object (or jquery if full
jquery is used). If you are using a bootstrap modal, you can call `modal` on this object

@@ -265,3 +265,3 @@ to show the modal.

**I'm using a Bootstrap Modal and the backdrop doesn't fade away**
#### I'm using a Bootstrap Modal and the backdrop doesn't fade away

@@ -288,3 +288,3 @@ This can happen if your modal template contains more than one top level element.

**The backdrop does not fade away after I call `close`** or **I don't want to use the 'data-dismiss' attribute on a button, how can I close a modal manually?**
#### The backdrop STILL does not fade away after I call `close` OR I don't want to use the 'data-dismiss' attribute on a button, how can I close a modal manually?

@@ -323,3 +323,3 @@ You can check the 'Complex' sample ([complexcontroller.js](samples/complex/complexcontroller.js)). The 'Cancel' button closes without using the `data-dismiss` attribute. In this case, just use the `preClose` option to ensure the bootstrap modal is removed:

**I'm using a Bootstrap Modal and the dialog doesn't show up**
#### I'm using a Bootstrap Modal and the dialog doesn't show up

@@ -334,3 +334,39 @@ Code is entered exactly as shown the example but when the showAModal() function fires the modal template html is appended to the body while the console outputs:

#### How can I prevent a Bootstrap modal from being closed?
If you are using a bootstrap modal and want to make sure that only the `close` function will close the modal (not a click outside or escape), use the following attributes:
```html
<div class="modal" data-backdrop="static" data-keyboard="false">
```
To do this programatically, use:
```js
ModalService.showModal({
templateUrl: "whatever.html",
controller: "WhateverController"
}).then(function(modal) {
modal.element.modal({
backdrop: 'static',
keyboard: false
});
modal.close.then(function(result) {
// ...etc
});
});
```
Thanks [lindamarieb](https://github.com/lindamarieb) and [ledgeJumper](https://github.com/ledgeJumper)!
#### Problems with Nested Modals
If you are trying to nest Bootstrap modals, you will run into issues. From Bootstrap:
> Bootstrap only supports one modal window at a time. Nested modals aren’t supported as we believe them to be poor user experiences.
See: https://v4-alpha.getbootstrap.com/components/modal/#how-it-works
Some people have been able to get them working (see https://github.com/dwmkerr/angular-modal-service/issues/176). Unfortunately, due to the lack of support in Bootstrap is has proven troublesome to support this in angular-modal-service.
## Thanks

@@ -337,0 +373,0 @@

@@ -144,2 +144,5 @@ 'use strict';

// Clear previous input focus to avoid open multiple modals on enter
document.activeElement.blur();
// We can track this modal in our open modals.

@@ -146,0 +149,0 @@ self.openModals.push({ modal: modal, close: inputs.close });

Sorry, the diff of this file is not supported yet

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