Skip to content
An ember-cli addon to manage modals as promises
JavaScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
addon
app
config
tests test(component): registes component with 2 words as name Dec 5, 2019
vendor
.commitlintrc.js
.editorconfig [MCH][DB-85440][fix] fix editorconfig Mar 8, 2018
.ember-cli
.eslintignore
.eslintrc.js
.gitignore
.npmignore
.releaserc
.template-lintrc.js
.travis.yml chore(ember): update to latest Dec 5, 2019
.watchmanconfig
CHANGELOG.md
CONTRIBUTING.md Update some packages. ESLint. Ember try Nov 27, 2018
LICENSE.md
README.md
ember-cli-build.js
index.js
package-lock.json
package.json
testem.js

README.md

ember-modal-service

Build Status GitHub version NPM version Dependency Status codecov Greenkeeper badge Ember Observer Score

An ember-cli addon to manage modals as promises.

Information

NPM

Install in ember-cli application

In your application's directory:

ember install ember-modal-service

Usage

// Inject the service
modal: Ember.inject.service(),

...

// To open a modal use the method `open` with the modal name and the options for the modal.
this.get('modal').open('foo', { bar: 'bar' });

// The returning value of the modal is a promise that is resolved or rejected when the modal is closed.
this.get('modal').open('foo').then(() => {
    // modal closed
});
// In order to register a new modal, you need to register the modal object in the application container.
// app/components/modal-foo.js
import ModalComponent from 'ember-modal-service/components/modal';
export default ModalComponent.extend();

All the modals are shown in the modal container.

{{! templates/application.hbs }}
{{modal-container}}

You can close all modals by using the close method.

this.get('modal').close();

Or just some of them.

this.get('modal').close((modal) => {
  return modal.name === 'foo';
});

this.get('modal').close('name', 'foo');

Base modal component provides resolve & reject actions so you can implement basic closing behaviour directly on the template. You can pass any arguments you want the modal to be resolved / rejected with

<button {{action "reject" "foo" "bar"}}>Close modal</button>

Contribute

If you want to contribute to this addon, please read the CONTRIBUTING.md.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

You can’t perform that action at this time.