{"id":21553189,"url":"https://github.com/bbvaengineering/ember-modal-service","last_synced_at":"2025-04-10T07:50:17.520Z","repository":{"id":21841211,"uuid":"94193722","full_name":"BBVAEngineering/ember-modal-service","owner":"BBVAEngineering","description":"An ember-cli addon to manage modals as promises","archived":false,"fork":false,"pushed_at":"2022-12-10T20:29:37.000Z","size":5136,"stargazers_count":27,"open_issues_count":30,"forks_count":11,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-08T02:53:37.946Z","etag":null,"topics":["ember-addon","ember-cli-addon","modals"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BBVAEngineering.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-13T09:12:13.000Z","updated_at":"2021-12-23T10:39:35.000Z","dependencies_parsed_at":"2023-01-13T21:42:16.725Z","dependency_job_id":null,"html_url":"https://github.com/BBVAEngineering/ember-modal-service","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-modal-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-modal-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-modal-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-modal-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BBVAEngineering","download_url":"https://codeload.github.com/BBVAEngineering/ember-modal-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248182010,"owners_count":21060891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ember-addon","ember-cli-addon","modals"],"created_at":"2024-11-24T07:09:46.213Z","updated_at":"2025-04-10T07:50:17.477Z","avatar_url":"https://github.com/BBVAEngineering.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ember-modal-service\n\n[![Build Status](https://travis-ci.org/BBVAEngineering/ember-modal-service.svg?branch=master)](https://travis-ci.org/BBVAEngineering/ember-modal-service)\n[![GitHub version](https://badge.fury.io/gh/BBVAEngineering%2Fember-modal-service.svg)](https://badge.fury.io/gh/BBVAEngineering%2Fember-modal-service)\n[![NPM version](https://badge.fury.io/js/ember-modal-service.svg)](https://badge.fury.io/js/ember-modal-service)\n[![Dependency Status](https://david-dm.org/BBVAEngineering/ember-modal-service.svg)](https://david-dm.org/BBVAEngineering/ember-modal-service)\n[![codecov](https://codecov.io/gh/BBVAEngineering/ember-modal-service/branch/master/graph/badge.svg)](https://codecov.io/gh/BBVAEngineering/ember-modal-service)\n[![Greenkeeper badge](https://badges.greenkeeper.io/BBVAEngineering/ember-modal-service.svg)](https://greenkeeper.io/)\n[![Ember Observer Score](https://emberobserver.com/badges/ember-modal-service.svg)](https://emberobserver.com/addons/ember-modal-service)\n\nAn [ember-cli addon](http://www.ember-cli.com/) to manage modals as promises.\n\n## Information\n\n[![NPM](https://nodei.co/npm/ember-modal-service.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/ember-modal-service/)\n\n## Install in ember-cli application\n\nIn your application's directory:\n\n```bash\nember install ember-modal-service\n```\n\n## Usage\n\n### Register the modal container\n\nAll the modals are shown inside the modal container once opened.\n\n```html\n{{! templates/application.hbs }}\n\u003cModalContainer /\u003e\n```\n\n### Create a modal component\n\nIn order to register a new modal, you need to register the modal object in the application container using the preffix `modal-*`.\n\n```javascript\n// app/components/modal-foo.js\nimport ModalComponent from 'ember-modal-service/components/modal';\n\nexport default class FooModal extends ModalComponent {\n   data = this.model.options.data; \n}\n```\n\n```html\n{{! app/templates/modal-foo.hbs }}\n\n\u003cdiv\u003e\n  \u003cp\u003e{{data}}\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Opening the modal\n\n```javascript\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';\n\nexport default class Controller extends Controller {\n  // Inject the service\n  @service modal;\n\n  @action\n  async doSomething() {\n    // To open a modal use the method `open` with the modal name and the options for the modal.\n    try {\n      const result = await this.modal.open('foo', { bar: 'bar' });\n\n      // Modal have been resolved\n    } catch(e) {\n      // Modal have been rejected\n    }\n  }\n```\n\n### Other useful things\n\nYou can close all modals by using the `close` method.\n\n```javascript\nthis.modal.close();\n```\n\nOr just some of them.\n\n```javascript\nthis.modal.close((modal) =\u003e {\n  return modal.name === 'foo';\n});\n\nthis.modal.close('name', 'foo');\n```\n\nBase modal component provides `resolve` \u0026 `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\n\n```html\n\u003cbutton {{fn this.reject \"foo\" \"bar\"}}\u003eResolve modal with two args\u003c/button\u003e\n\n\u003cbutton {{fn this.reject \"foo\" \"bar\"}}\u003eReject modal with two args\u003c/button\u003e\n```\n\n## Contribute\n\nIf you want to contribute to this addon, please read the [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/BBVAEngineering/ember-modal-service/tags).\n\n\n## Authors\n\nSee the list of [contributors](https://github.com/BBVAEngineering/ember-modal-service/graphs/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbvaengineering%2Fember-modal-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbvaengineering%2Fember-modal-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbvaengineering%2Fember-modal-service/lists"}