{"id":15184673,"url":"https://github.com/j-siu/ng2-simple-global","last_synced_at":"2025-10-01T23:30:50.738Z","repository":{"id":132734745,"uuid":"70210211","full_name":"J-Siu/ng2-simple-global","owner":"J-Siu","description":"A simple global variable service for Angular 2","archived":true,"fork":false,"pushed_at":"2022-05-16T16:58:18.000Z","size":12,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-09-28T17:21:48.226Z","etag":null,"topics":["angular","angular-2","angular2","global","ng2"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/J-Siu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-07T02:45:27.000Z","updated_at":"2023-01-28T00:45:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"7d26f14e-fec5-4a24-a654-f807c7d2c130","html_url":"https://github.com/J-Siu/ng2-simple-global","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":"0.16666666666666663","last_synced_commit":"1449db019b77e6e6922987a2ae7414bf83e6eef7"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Siu%2Fng2-simple-global","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Siu%2Fng2-simple-global/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Siu%2Fng2-simple-global/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J-Siu%2Fng2-simple-global/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/J-Siu","download_url":"https://codeload.github.com/J-Siu/ng2-simple-global/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234909086,"owners_count":18905504,"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","angular-2","angular2","global","ng2"],"created_at":"2024-09-27T17:21:41.716Z","updated_at":"2025-10-01T23:30:45.470Z","avatar_url":"https://github.com/J-Siu.png","language":"TypeScript","funding_links":["https://www.paypal.com/donate/?business=HZF49NM9D35SJ\u0026no_recurring=0\u0026currency_code=CAD"],"categories":[],"sub_categories":[],"readme":"# Angular Simple Global [![Paypal donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate/?business=HZF49NM9D35SJ\u0026no_recurring=0\u0026currency_code=CAD)\n\nA simple global variable service for Angular.\n\n\u003e To enable faster update, ng2-simple-global switched to Angular CLI starting 8.2.0 and use new repository https://github.com/J-Siu/ng2-simple-global-lib/\n\u003e\n\u003e Project contains both library and example.\n\u003e\n\u003e All version \u003c 8.2.0 are in old repository https://github.com/J-Siu/ng2-simple-global/\n\n### Table Of Content\n\u003c!-- TOC --\u003e\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Import into Angular 2 application typescript](#import-into-angular-2-application-typescript)\n  - [API](#api)\n- [Repository](#repository)\n- [Example](#example)\n- [Contributors](#contributors)\n- [Changelog](#changelog)\n- [License](#license)\n\n\u003c!-- /TOC --\u003e\n\n### Install\n\n```\nnpm install ng2-simple-global\n```\n\n### Usage\n\n#### Import into Angular 2 application (typescript)\n\n`ng2-simple-global` is implemented as Angular 2 injectable service name __SimpleGlobal__.\n\n__For module using SimpleGlobal__\n\nAdd `SimpleGlobal` into module providers.\n\n```javascript\nimport { SimpleGlobal } from 'ng2-simple-global';\n\n@NgModule({\n\tproviders: [SimpleGlobal]\n})\n```\n\n__For each child component using SimpleGlobal__\n\n```javascript\nimport {SimpleGlobal} from 'ng2-simple-global';\n\nexport class ChildComponent {\n\n\tconstructor(private sg: SimpleGlobal) { }\n\n}\n```\n\n#### API\n\n```javascript\nimport {SimpleGlobal} from 'ng2-simple-global';\n\n@Component({\n\tselector: 'child-com',\n\ttemplate: `\n\t\t\u003cp\u003eThis is a global variable: {{sg.gv}}\u003c/p\u003e\n\t\t\u003cinput type=\"text\" [(ngModel)]=\"sg.gv\"\u003e\n\t`\n})\nexport class ChildComponent {\n\n\tlocalVar;\n\n\tconstructor(private sg: SimpleGlobal) {\n\t\tif (this.sg['gv']) {\n\t\t\tthis.localVar = this.sg['gv'];\n\t\t}\n\t}\n\n}\n```\n\nTreat `SimpleGlobal` instance as a global object and create/assign additional attributes freely, and it will be accessible to all component using the service.\n\n### Repository\n\n[ng2-simple-global](https://github.com/J-Siu/ng2-simple-global)\n\n### Example\n\n[ng2-simple-global-example](https://github.com/J-Siu/ng2-simple-global-example)\n\n[plunker](http://plnkr.co/J4GvVp)\n\n### Contributors\n\n* [John Sing Dao Siu](https://github.com/J-Siu)\n\n\n### Changelog\n\n* 1.2.0\n\t- Support Angular ^2.0.0\n\t- Clean up package\n* 1.2.1\n\t- Add license file\n\t- Add punker example\n* 1.2.2\n\t- Update package.json\n\t- Update Readme.md\n* 1.2.3\n\t- Support Angular2 ^2.4.1\n* 1.2.4\n\t- Due to the rapid release cycle of Angular, to minimize update purely due to `peerDependencies`, it is modified as follow:\n\t\t`\"peerDependencies\": { \"@angular/core\": \"\u003e=2.4.0\" }`\n* 1.2.5\n\t- Update to support Angular 4.3.1. Please use previous version for Angular 2.x.x.\n\n### License\n\nThe MIT License\n\nCopyright (c) 2017\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-siu%2Fng2-simple-global","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-siu%2Fng2-simple-global","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-siu%2Fng2-simple-global/lists"}