{"id":22127282,"url":"https://github.com/jaytrig/ngx-modal-service","last_synced_at":"2026-05-01T01:32:13.157Z","repository":{"id":45836337,"uuid":"138362039","full_name":"Jaytrig/ngx-modal-service","owner":"Jaytrig","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-16T10:46:58.000Z","size":129,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T10:41:04.417Z","etag":null,"topics":["angular","modal"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jaytrig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-23T01:31:44.000Z","updated_at":"2022-07-17T10:54:10.000Z","dependencies_parsed_at":"2022-09-08T04:52:00.508Z","dependency_job_id":null,"html_url":"https://github.com/Jaytrig/ngx-modal-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaytrig%2Fngx-modal-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaytrig%2Fngx-modal-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaytrig%2Fngx-modal-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaytrig%2Fngx-modal-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaytrig","download_url":"https://codeload.github.com/Jaytrig/ngx-modal-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245233331,"owners_count":20581782,"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":["angular","modal"],"created_at":"2024-12-01T17:17:44.572Z","updated_at":"2026-05-01T01:32:13.121Z","avatar_url":"https://github.com/Jaytrig.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"```javascript\n\n//Component\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.scss']\n})\nexport class AppComponent {\n\n\n    constructor(private modalCtrl: NgxModalController) {}\n\n    Open() {\n        const modal = this.modalCtrl.showModal(AppComponent);\n\n        //optional promise to retrive data from modal\n        modal.onDismiss.then((data) =\u003e {\n            //data returned from modal if any.\n        })\n    }\n}\n\n//MODAL (Any component)\n\n@Component({\n  selector: 'info-dialog',\n  templateUrl: './info-dialog.component.html',\n  styleUrls: ['./info-dialog.component.scss']\n})\nexport class InfoDialogComponent {\n\n    //ViewController allows to close the modal (optional)\n    //NavParams are to retive the data passed to the modal (optional)\n    constructor(private ViewCtrl: ViewController, private Params: NavParams) {}\n\n    Close(){\n\n        //dismiss the modal with the ViewController\n        this.ViewCtrl.dismiss();\n\n        //pass data back to onDismiss callback\n        //this.ViewCtrl.dismiss({ hello : \"world\"});\n    }\n\n}\n```\n\n## API\n- NgxModalServiceModule\n- NgxModalController\n- NgxModalOptions\n- NgxModalResponse\n- ViewController\n- NavParams\n\n\n\n### NgxModalServiceModule\n```javascript\nimport { NgxModalServiceModule } from 'ngx-modal-service';\n\n@NgModule({\n  imports: [\n    NgxModalServiceModule\n  ]\n})\nexport class AppModule { }\n```\n\n### NgxModalController, NgxModalOptions\n\n```javascript    \n    let modal = this.modalCtrl.showModal(Component, Data, Options);\n\n    modal.onDismiss.then((ReturnData) =\u003e {\n      console.log(data);\n    });\n```\n\n- Component: This can be any registered component.\n- Data: Has to be any Object. (Optional)\n- Options: Has to follow NgxModalOptions\n```javascript    \n    export interface NgxModalOptions {\n        height?: number; // modals height defaults to 500 (px)\n        maxHeight?: number; // modals max-height no default\n        width?: number; // modals width defaults to 500 (px)\n        index?: number; //z-index, auto increments per modal by deafault.\n        backdrop?: boolean; //Backdrop present default true\n        backdropDismiss?: boolean; //modal dismiss on backdrop click default true\n        top?: number, //modal top postion default centers\n        bottom?: number, //modal bottom postion default centers\n        left?: number, //modal left postion default centers\n        right?: number //modal right postion default centers\n        borderColor?: string; //modals border-color default black\n    }\n\n```\n- onDismiss: Event fired when ViewController dismiss is call on the targeted modal.\n- ReturnData: can be of type NgxModalResponse (Optional)\n```javascript    \n    export interface NgxModalResponse {\n        success: boolean; // set to false is closed by modal.\n        data: any; // data returned from modal\n    }\n```\n\n### ViewController, NavParams\n\n\nBoth of these are optional.\n\n```javascript    \n    constructor(private ViewCtrl: ViewController, private Params: NavParams) {}\n\n    Close() {\n    \n        let Data: NgxModalResponse =  {\n            success: true, // useful to see modal confirm or cancel is pressed.\n            data: {hello:\"world\"}\n        }\n\n        this.ViewCtrl.dismiss(Data);\n\n        //or if you have no data to pass back\n        //this.ViewCtrl.dismiss();\n    }\n\n    Log(){\n        \n        this.Params // this Data from this.modalCtrl.showModal(Component, Data, Options);\n    }\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaytrig%2Fngx-modal-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaytrig%2Fngx-modal-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaytrig%2Fngx-modal-service/lists"}