{"id":19078681,"url":"https://github.com/jsayol/ngx-local","last_synced_at":"2025-07-17T18:08:01.762Z","repository":{"id":91866444,"uuid":"77186565","full_name":"jsayol/ngx-local","owner":"jsayol","description":"Structural directive for Angular 2.x+ to locally store a value in a template input variable","archived":false,"fork":false,"pushed_at":"2016-12-26T00:04:58.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T01:29:56.894Z","etag":null,"topics":["angular","angular2","async","ngx","typescript"],"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/jsayol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-23T01:03:09.000Z","updated_at":"2017-01-03T15:52:01.000Z","dependencies_parsed_at":"2023-05-24T22:17:10.981Z","dependency_job_id":null,"html_url":"https://github.com/jsayol/ngx-local","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":"0.18181818181818177","last_synced_commit":"68686042e5242a2cd0697235c31d17769fe348b3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsayol%2Fngx-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsayol%2Fngx-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsayol%2Fngx-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsayol%2Fngx-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsayol","download_url":"https://codeload.github.com/jsayol/ngx-local/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240131773,"owners_count":19752725,"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","angular2","async","ngx","typescript"],"created_at":"2024-11-09T02:11:25.220Z","updated_at":"2025-02-22T05:27:19.547Z","avatar_url":"https://github.com/jsayol.png","language":"TypeScript","readme":"# ngx-local\n[![npm version](https://badge.fury.io/js/ngx-local.svg)](https://www.npmjs.com/package/ngx-local)\n\n[MIT License](LICENSE.txt)\n\nStructural directive for Angular 2.x+ to locally store a value in a template input variable.\n\nThis is particularly useful when used in conjunction with the 'async' pipe:\n```html\n\u003cdiv *ngxLocal=\"httpUser$ | async; let user\"\u003e\n  \u003cdiv\u003eid: {{ user?.id }}\u003c/div\u003e\n  \u003cdiv\u003ename: {{ user?.name }}\u003c/div\u003e\n  \u003cdiv\u003eusername: {{ user?.username }}\u003c/div\u003e\n  \u003cdiv\u003eemail: {{ user?.email }}\u003c/div\u003e\n\u003c/div\u003e\n```\n\n\n## Installation\n\nVia npm\n```\nnpm install ngx-local --save\n```\n\nVia yarn\n```\nyarn add ngx-local\n```\n\nThen add the directive to your app.module.ts:\n\n```ts\n// ...\nimport { NgxLocal } from 'ngx-local';\n\n@NgModule({\n  // ...\n  declarations: [\n    // ...\n    NgxLocal\n  ],\n  // ...\n})\nexport class AppModule {\n}\n```\n\n## Sample usage\n\n```ts\nimport { Component } from '@angular/core';\nimport { Http, Response } from '@angular/http';\nimport { Observable } from 'rxjs/Observable';\nimport 'rxjs/add/operator/map';\n\n@Component({\n  selector: 'my-app',\n  template: `\n    \u003cdiv *ngxLocal=\"httpUser$ | async; let user\"\u003e\n      \u003cdiv\u003eid: {{ user?.id }}\u003c/div\u003e\n      \u003cdiv\u003ename: {{ user?.name }}\u003c/div\u003e\n      \u003cdiv\u003eusername: {{ user?.username }}\u003c/div\u003e\n      \u003cdiv\u003eemail: {{ user?.email }}\u003c/div\u003e\n    \u003c/div\u003e\n  `,\n})\nexport class AppComponent {\n  httpUser$: Observable\u003cUser\u003e;\n\n  constructor(private http: Http) {\n    const randomUserId = Math.floor(Math.random() * 10) + 1;\n\n    this.httpUser$ = this.http\n      .get(`https://jsonplaceholder.typicode.com/users/${randomUserId}`)\n      .map((res: Response): User =\u003e res.json() || {});\n  };\n}\n\nexport interface User {\n  id: number;\n  name: string;\n  username: string;\n  email: string;\n}\n```\n\n## TO-DO\n- [x] Release!\n- [ ] **Add tests**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsayol%2Fngx-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsayol%2Fngx-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsayol%2Fngx-local/lists"}