{"id":19309824,"url":"https://github.com/paulorohling/ng-sub","last_synced_at":"2025-07-17T15:34:40.590Z","repository":{"id":56729872,"uuid":"524282089","full_name":"pauloRohling/ng-sub","owner":"pauloRohling","description":"A standalone angular directive to avoid creating multiple subscriptions with AsyncPipe. 💡","archived":false,"fork":false,"pushed_at":"2024-04-27T17:09:33.000Z","size":363,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-05T05:06:29.397Z","etag":null,"topics":["angular","async","directives","pipe","standalone","subscription","unsubscribe"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@reactive-wind/ng-sub","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/pauloRohling.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-08-13T02:45:14.000Z","updated_at":"2025-01-03T14:17:55.000Z","dependencies_parsed_at":"2024-11-10T00:22:35.725Z","dependency_job_id":"e25c87c5-56ce-4679-84d0-5ee15ddad708","html_url":"https://github.com/pauloRohling/ng-sub","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":"0.13636363636363635","last_synced_commit":"55d3818e5b57dd7b8f8cd27af73d0140a406826d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/pauloRohling/ng-sub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauloRohling%2Fng-sub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauloRohling%2Fng-sub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauloRohling%2Fng-sub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauloRohling%2Fng-sub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pauloRohling","download_url":"https://codeload.github.com/pauloRohling/ng-sub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauloRohling%2Fng-sub/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265623014,"owners_count":23800086,"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","async","directives","pipe","standalone","subscription","unsubscribe"],"created_at":"2024-11-10T00:20:58.559Z","updated_at":"2025-07-17T15:34:40.549Z","avatar_url":"https://github.com/pauloRohling.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NgSubDirective\n\n[![npm](https://img.shields.io/npm/v/@reactive-wind/ng-sub)](https://www.npmjs.com/package/@reactive-wind/ng-sub)\n[![npm](https://img.shields.io/npm/dw/@reactive-wind/ng-sub)](https://www.npmjs.com/package/@reactive-wind/ng-sub)\n\nThis is a **Standalone Angular Directive** to avoid creating multiple subscriptions with AsyncPipe by centralizing the subscription and providing it through template context.\n\n## Prerequisites\n\n- Angular 17.3\n\n## Installation\n\n```bash\nnpm install --save-dev @reactive-wind/ng-sub\n```\n\n## Usage\n\nTo use the `ngSub` directive, follow these steps:\n\n1. Import the `NgSubDirective` into your Angular component:\n\n   ```typescript\n   import { Component } from \"@angular/core\";\n   import { NgSubDirective } from \"@reactive-wind/ng-sub\";\n   import { Observable } from \"rxjs\";\n   \n   @Component({\n     standalone: true,\n     selector: \"app-your-component\",\n     templateUrl: \"./your-component.component.html\",\n     styleUrls: [\"./your-component.component.scss\"],\n     imports: [NgSubDirective] // \u003c-- Import the directive\n   })\n   export class YourComponent {\n     message$: Observable\u003cMessage\u003e; // \u003c-- Define your observable\n   }\n   ```\n\n2. Use the `ngSub` directive in your template:\n\n   ```html\n   \u003cng-container *ngSub=\"message$ as message\"\u003e\n     \u003capp-message-danger [text]=\"message\"\u003e\u003c/app-message-danger\u003e\n     \u003capp-message-light [text]=\"message\"\u003e\u003c/app-message-light\u003e\n     \u003capp-message-success [text]=\"message\"\u003e\u003c/app-message-success\u003e\n   \u003c/ng-container\u003e\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulorohling%2Fng-sub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulorohling%2Fng-sub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulorohling%2Fng-sub/lists"}