Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
306a8f8
chore(package): update dependencies
greenkeeper[bot] Jan 27, 2018
4b2d817
docs(readme): add Greenkeeper badge
greenkeeper[bot] Jan 27, 2018
1033017
exporting name
nakamurabh Apr 20, 2018
caff650
updated
nakamurabh Apr 20, 2018
447f0fc
fix npm
nakamurabh Apr 20, 2018
df9896e
fixed
nakamurabh Apr 20, 2018
75da016
prevent error if modal is already destroyed
Jul 30, 2018
3833e50
removed debugger
Jul 30, 2018
74c85bf
bail out if modalElement is falsey, to reduce indentation
matteobarone Aug 6, 2018
264a9df
Merge pull request #240 from matteobarone/prevent-error
dwmkerr Aug 11, 2018
6dc4f11
Merge pull request #239 from nakamurabh/master
dwmkerr Aug 11, 2018
daa7902
Merge pull request #230 from dwmkerr/greenkeeper/initial
dwmkerr Aug 11, 2018
99e8214
chore: more idiomatic markdown heading
dwmkerr Aug 11, 2018
40ce77c
chore: build dst
dwmkerr Aug 11, 2018
5d54cb9
0.14.1
dwmkerr Aug 11, 2018
6e9d833
docs: fix description for how to create a release
dwmkerr Aug 11, 2018
e3e72f6
feat: circleci for builds
dwmkerr Aug 13, 2018
a45e062
build: adding test and coverage artifacts
dwmkerr Aug 13, 2018
ea673db
chore: add workflow
dwmkerr Aug 13, 2018
46c5ec8
chore: fix build
dwmkerr Aug 13, 2018
72d6d75
chore: fix build
dwmkerr Aug 13, 2018
fd25995
chore(package): update karma-webpack to version 3.0.1
greenkeeper[bot] Sep 1, 2018
5389818
Do not close a second time if close() has already been called
Oct 12, 2018
b67645a
docs(readme): add GuardRails badge
guardrails[bot] Oct 13, 2018
a690cf4
Do not call cleanUpClose a second time after objects have already bee…
Oct 15, 2018
9a27ab2
Merge pull request #248 from SynergyDataSystems/master
dwmkerr Oct 16, 2018
60d1823
Merge branch 'master' into feat/circleci
dwmkerr Oct 16, 2018
57f64ea
build: update to latest webpack and babel
dwmkerr Oct 16, 2018
cacd0eb
chore: update all tests to use mocha
dwmkerr Oct 16, 2018
19a38eb
build: include the browsers on the circleci build
dwmkerr Oct 16, 2018
273bce5
build: remove coveralls, add badge
dwmkerr Oct 16, 2018
a7bce85
chore: update webpack dev server
dwmkerr Oct 16, 2018
cefd0da
Merge pull request #241 from dwmkerr/feat/circleci
dwmkerr Oct 16, 2018
114d218
build: adds support for codecov.io
dwmkerr Oct 16, 2018
8f87172
Merge pull request #250 from dwmkerr/feat/codecov
dwmkerr Oct 16, 2018
d11d994
chore: build distributables
dwmkerr Oct 16, 2018
d93cdd3
0.14.2
dwmkerr Oct 16, 2018
0a10c96
chore(package): update karma to version 3.1.0
greenkeeper[bot] Oct 22, 2018
78e5a84
chore(package): update lockfile package-lock.json
greenkeeper[bot] Oct 22, 2018
8a03d00
Merge pull request #251 from dwmkerr/greenkeeper/karma-3.1.0
dwmkerr Oct 23, 2018
a3892a3
added support for passing a selector to appendElement
decherneyge Nov 7, 2018
0af3249
added .idea to gitignore
decherneyge Nov 7, 2018
3e4909c
converted angular-modal-service from a factory to a provider so defau…
decherneyge Nov 7, 2018
82a0ba6
added documentation for configuring globals
decherneyge Nov 7, 2018
4311e21
Update README.md
dwmkerr Nov 9, 2018
18bc761
Merge pull request #252 from decherneyge/feature/appendSelectorSupport
dwmkerr Nov 9, 2018
350edd0
Merge branch 'master' into feature/UtilizeProvider
decherneyge Nov 9, 2018
a907b0e
updated the complex example to show how to handle bootstraps backgrou…
decherneyge Nov 9, 2018
f45e0b1
Merge pull request #253 from decherneyge/feature/UtilizeProvider
dwmkerr Nov 10, 2018
3d5ae94
docs: cleanup README, prep 0.8 release notes
dwmkerr Nov 10, 2018
ccb47be
docs: update contributors
dwmkerr Nov 10, 2018
6c457e7
Merge pull request #255 from dwmkerr/build/release-0.8
dwmkerr Nov 10, 2018
aa0877b
0.15.0
dwmkerr Nov 10, 2018
a95734c
docs: fix incorrect version number in CHANGELOG
dwmkerr Nov 10, 2018
22cda41
Merge pull request #254 from decherneyge/feature/complexExampleBackgr…
dwmkerr Nov 10, 2018
6609675
Invoke optional controller onInit function to conform to AngularJS 1.…
DougKeller Dec 3, 2018
1d6bc14
Add comment for context as well as link to documentation
DougKeller Dec 5, 2018
d420f70
Merge pull request #257 from DougKeller/master
dwmkerr Dec 8, 2018
c722c2a
chore: update dist
dwmkerr Dec 8, 2018
06a7b74
0.15.1
dwmkerr Dec 8, 2018
fa2c0aa
Guard from close function being called multiple times when location c…
DougKeller Jan 17, 2019
29ef82a
Rebuild the angular modal service
DougKeller Feb 4, 2019
a0f5b2f
Merge pull request #259 from DougKeller/master
dwmkerr Feb 11, 2019
fbd69bd
chore(package): update mocha to version 6.0.0
greenkeeper[bot] Feb 18, 2019
3de4e2f
chore(package): update lockfile package-lock.json
greenkeeper[bot] Feb 18, 2019
d00a0c1
Merge pull request #261 from dwmkerr/greenkeeper/mocha-6.0.0
dwmkerr Feb 26, 2019
864eb52
chore(package): update karma to version 4.0.1
greenkeeper[bot] Feb 28, 2019
c3df80c
chore(package): update lockfile package-lock.json
greenkeeper[bot] Feb 28, 2019
ffc65ad
Merge pull request #262 from dwmkerr/greenkeeper/karma-4.0.1
dwmkerr Mar 1, 2019
927a83d
feat: angular 1.7 support
dwmkerr Mar 21, 2019
27d8671
0.15.2
dwmkerr Mar 21, 2019
2879036
Merge pull request #264 from dwmkerr/feat/angular-1.7-support
dwmkerr Mar 21, 2019
653e709
Add support for component-bound modals
DougKeller Apr 30, 2019
6998575
Build
DougKeller Apr 30, 2019
ce68174
Simplify controller
DougKeller Apr 30, 2019
63e7ad9
Add tests for component option
DougKeller Apr 30, 2019
37a7da2
Update readme with component support
DougKeller Apr 30, 2019
4c2a146
Merge pull request #249 from dwmkerr/guardrails/initial
dwmkerr May 6, 2019
8743343
rename controller -> component
DougKeller May 9, 2019
4c1f2a1
Merge branch 'master' of https://github.com/topechelon/angular-modal-…
dwmkerr Jun 3, 2019
9cc6e7c
chore: update package lock
dwmkerr Jun 3, 2019
df78414
Merge branch 'topechelon-master'
dwmkerr Jun 3, 2019
d895056
docs: clean up table of contents, add thanks
dwmkerr Jun 3, 2019
f23593c
0.15.3
dwmkerr Jun 3, 2019
570e133
chore(package): update karma-chrome-launcher to version 3.0.0
greenkeeper[bot] Jul 12, 2019
3ed6723
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jul 12, 2019
44f502d
Merge pull request #267 from dwmkerr/greenkeeper/karma-chrome-launche…
dwmkerr Jul 13, 2019
a812347
chore(package): update karma-coverage to version 2.0.0
greenkeeper[bot] Aug 20, 2019
058a8ec
chore(package): update lockfile package-lock.json
greenkeeper[bot] Aug 20, 2019
a5cb9b0
Create FUNDING.yml
dwmkerr Oct 28, 2019
d9fbff9
Merge pull request #271 from dwmkerr/greenkeeper/karma-coverage-2.0.0
dwmkerr Oct 29, 2019
e25f603
Merge branch 'master' into greenkeeper/karma-webpack-3.0.1
dwmkerr Oct 29, 2019
20e95b0
chore: fix karma webpack
dwmkerr Oct 29, 2019
bfe3dd2
Merge pull request #247 from dwmkerr/greenkeeper/karma-webpack-3.0.1
dwmkerr Oct 29, 2019
502782d
chore: update dependencies to eliminate potential vulnerabilities
dwmkerr Jan 28, 2020
3b14498
chore: update dev dependencies
dwmkerr Apr 28, 2020
109efe4
chore: update dev dependencies
dwmkerr Apr 28, 2020
fe83431
chore(release): 0.15.4
dwmkerr Apr 28, 2020
6680bdb
docs: update release guide
dwmkerr Apr 28, 2020
01525d3
chore(release): 0.15.5
dwmkerr Apr 28, 2020
383ca51
chore: build artifacts
dwmkerr Apr 28, 2020
9328a54
chore(release): 0.15.6
dwmkerr Apr 28, 2020
a0b8fea
chore(package): update standard-version to version 8.0.0
greenkeeper[bot] May 6, 2020
6a999f1
chore(package): update lockfile package-lock.json
greenkeeper[bot] May 6, 2020
0472600
Merge pull request #279 from dwmkerr/greenkeeper/standard-version-8.0.0
dwmkerr May 7, 2020
dfebf2b
chore: update dependencies
dwmkerr Sep 8, 2020
3ddaf86
Merge branch 'master' of github.com:dwmkerr/angular-modal-service
dwmkerr Sep 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 2
jobs:
build:
working_directory: ~/project
docker:
- image: circleci/node:8-browsers
environment:
CHROME_BIN: "/usr/bin/google-chrome"
steps:
- checkout
- run:
name: update-npm
command: 'sudo npm install -g npm@latest'
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: install-npm
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: test
command: npm test
- run:
name: upload coverage
command: bash <(curl -s https://codecov.io/bash)
- store_artifacts:
path: dst
destination: dst
- store_artifacts:
path: test-results.xml
destination: tests
- store_artifacts:
path: coverage
destination: coverage
- store_test_results:
path: ./build/test-results.xml
workflows:
version: 2
build:
jobs:
- build:
# All branches, all tags.
filters:
tags:
only: /.*/
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Support 'GitHub Sponsors' funding.
github: dwmkerr
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ bower_components
node_modules
build
.DS_Store
.idea

artifacts/


lcov\.info
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.15.6](https://github.com/dwmkerr/angular-modal-service/compare/v0.15.5...v0.15.6) (2020-04-28)

### [0.15.5](https://github.com/dwmkerr/angular-modal-service/compare/v0.15.4...v0.15.5) (2020-04-28)

### [0.15.4](https://github.com/dwmkerr/angular-modal-service/compare/v0.15.3...v0.15.4) (2020-04-28)

## v0.15.0

* Support for a globally configurable close timeout. Thanks [decherneyge](https://github.com/decherneyge).
* Support for selector for `appendElement`. Thanks [decherneyge](https://github.com/decherneyge).
* Tooling version updates.

## v0.7.12

* Support for configuration of the `$locationChangeSuccess` event. Thanks [smalbs](https://github.com/smalbs).
Expand Down
94 changes: 72 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
angular-modal-service
=====================
# 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)
[![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)
[![Greenkeeper badge](https://badges.greenkeeper.io/dwmkerr/angular-modal-service.svg)](https://greenkeeper.io/) [![GuardRails badge](https://badges.production.guardrails.io/dwmkerr/angular-modal-service.svg)](https://www.guardrails.io)

Modal service for AngularJS - supports creating popups and modals via a service. See [a quick fiddle](http://jsfiddle.net/dwmkerr/8MVLJ/) or a full set of samples at [dwmkerr.github.io/angular-modal-service](http://dwmkerr.github.io/angular-modal-service).
Modal service for AngularJS - supports creating popups and modals via a service. Full support for Angular 1.5+ components. See [a quick fiddle](http://jsfiddle.net/dwmkerr/8MVLJ/) or a full set of samples at [dwmkerr.github.io/angular-modal-service](http://dwmkerr.github.io/angular-modal-service).

1. [Usage](#usage)
2. [Developing](#developing)
3. [Tests](#tests)
4. [FAQ & Troubleshooting](#faq)
5. [Thanks](#thanks)
<!-- vim-markdown-toc GFM -->

* [Usage](#usage)
* [Support for AngularJS 1.5.x Components](#support-for-angularjs-15x-components)
* [ShowModal Options](#showmodal-options)
* [The Modal Object](#the-modal-object)
* [The Modal Controller](#the-modal-controller)
* [Closing All Modals](#closing-all-modals)
* [Animation](#animation)
* [Error Handing](#error-handing)
* [Global Options Configuration](#global-options-configuration)
* [Developing](#developing)
* [Tests](#tests)
* [Releasing](#releasing)
* [FAQ](#faq)
* [Thanks](#thanks)

<!-- vim-markdown-toc -->

## Usage

Expand Down Expand Up @@ -87,7 +100,7 @@ The `close` function is automatically injected to the modal controller and takes
object (which is passed to the `close` and `closed` promises used by the caller). It can
take an optional second parameter, the number of milliseconds to wait before destroying the
DOM element. This is so that you can have a delay before destroying the DOM element if you
are animating the closure.
are animating the closure. See [Global Config](#global-options-configuration) for setting a default delay.

Now just make sure the `close` function is called by your modal controller when the modal
should be closed and that's it. Quick hint - if you are using Bootstrap for your modals,
Expand Down Expand Up @@ -126,8 +139,26 @@ ModalService.showModal({
},
controllerAs : "futurama"
})

```


## Support for AngularJS 1.5.x Components

It's also possible to specify a component, rather than a template and controller. This can be done by providing a `component` and an optional `bindings` value to the `showModal` function.

```js
ModalService.showModal({
component: 'myComponent',
bindings: {
name: 'Foo',
myRecord: { id: '123' }
}
})
```
#### ShowModal Options


### ShowModal Options

The `showModal` function takes an object with these fields:

Expand All @@ -138,13 +169,15 @@ The `showModal` function takes an object with these fields:
HTML for the modal.
* `inputs`: A set of values to pass as inputs to the controller. Each value provided
is injected into the controller constructor.
* `appendElement`: The custom angular element to append the modal to instead of default `body` element.
* `component`: Renders a modal with the provided component as its template
* `bindings`: Optional. If `component` is provided, all properties in `bindings` will be bound to the rendered `component`.
* `appendElement`: The custom angular element or selector (such as `#element-id`) to append the modal to instead of default `body` element.
* `scope`: Optional. If provided, the modal controller will use a new scope as a child of `scope` (created by calling `scope.$new()`) rather than a new scope created as a child of `$rootScope`.
* `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 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.
* `locationChangeSuccess`: Optional. Allows the closing of the modal when the location changes to be configured. If no value is set, the modal is closed immediately when the `$locationChangeSuccess` event fires. If `false` is set, event is not fired. If a number `n` is set, then the event fires after `n` milliseconds.

#### The Modal Object
### The Modal Object

The `modal` object returned by `showModal` has this structure:

Expand All @@ -156,7 +189,7 @@ The `modal` object returned by `showModal` has this structure:
* `modal.close` - A promise which is resolved when the modal `close` function is called.
* `modal.closed` - A promise which is resolved once the modal has finished animating out of the DOM.

#### The Modal Controller
### The Modal Controller

The controller that is used for the modal always has one extra parameter injected, a function
called `close`. Call this function with any parameter (the result). This result parameter is
Expand Down Expand Up @@ -215,6 +248,21 @@ ModalService.showModal({
});
```

### Global Options Configuration

To configure the default options that will apply to all modals call `configureOptions` on the `ModalServiceProvider`.

```js
app.config(["ModalServiceProvider", function(ModalServiceProvider) {

ModalServiceProvider.configureOptions({closeDelay:500});

}]);
```

Here are the available global options:
* `closeDelay` - This sets the default number of milliseconds to use in the close handler. This delay will also be used in the `closeModals` method and as the default for `locationChangeSuccess`.

## Developing

To work with the code, just run:
Expand Down Expand Up @@ -253,14 +301,14 @@ To create a release:

- Create the `dst` pack with `npm run build`
- Merge your work to master
- Use `npm version` to bump, e.g. `npm version patch`
- Push and deploy `git push --tags && git push && npm deploy`
- Use `npm run release` to tag, bump the version numbers and update the changelog
- Push and deploy `git push --follow-tags && npm publish`

## FAQ

Having problems? Check this FAQ first.

#### 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**

This can happen if your modal template contains more than one top level element.
Imagine this case:
Expand All @@ -282,7 +330,7 @@ It will try and make both elements into a modal. This means both elements will g
In this case, either remove the extra elements, or find the specific element you need
from the provided `modal.element` property.

#### 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?
**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?**

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:

Expand Down Expand Up @@ -316,7 +364,7 @@ app.controller('ExampleModalController', [
}]);
```

#### 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**

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:

Expand All @@ -326,7 +374,7 @@ TypeError: undefined is not a function

Pointing to the code: `modal.element.modal();`. This occurs if you are using a Bootstap modal but have not included the Bootstrap JavaScript. The recommendation is to include the modal JavaScript before AngularJS.

#### How can I prevent a Bootstrap modal from being closed?
**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:

Expand All @@ -353,7 +401,7 @@ ModalService.showModal({

Thanks [lindamarieb](https://github.com/lindamarieb) and [ledgeJumper](https://github.com/ledgeJumper)!

#### Problems with Nested Modals
**Problems with Nested Modals**

If you are trying to nest Bootstrap modals, you will run into issues. From Bootstrap:

Expand All @@ -367,6 +415,7 @@ Some people have been able to get them working (see https://github.com/dwmkerr/a

Thanks go the the following contributors:

* [DougKeller](https://github.com/DougKeller) - Adding support for Angular 1.5 components.
* [joshvillbrandt](https://github.com/joshvillbrandt) - Adding support for `$templateCache`.
* [cointilt](https://github.com/cointilt) - Allowing the modal to be added to a custom element, not just the body.
* [kernowjoe](https://github.com/kernowjoe) - controllerAs
Expand All @@ -376,3 +425,4 @@ Thanks go the the following contributors:
* [kernowjoe](https://github.com/kernowjoe) - Robustness around locationChange
* [arthur-xavier](https://github.com/arthur-xavier) - Robustness when `body` element changes.
* [stormpooper](https://github.com/StormPooper) - The new `bodyClass` feature.
* [decherneyge](https://github.com/decherneyge) - Provider features, global configuration, `appendElement` improvements.
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-modal-service",
"version": "0.12.2",
"version": "0.15.6",
"homepage": "https://github.com/dwmkerr/angular-modal-service",
"authors": [
"Dave Kerr (github.com/dwmkerr)"
Expand Down Expand Up @@ -29,9 +29,9 @@
"*.yml"
],
"dependencies": {
"angular": "1.5.0 - 1.6.x"
"angular": "1.5.0 - 1.7.x"
},
"devDependencies": {
"angular-mocks": "1.5.0 - 1.6.x"
"angular-mocks": "1.5.0 - 1.7.x"
}
}
Loading