{"id":15067585,"url":"https://github.com/reyesoft/ngx-jsonapi","last_synced_at":"2026-02-05T19:01:03.707Z","repository":{"id":25952311,"uuid":"106140885","full_name":"reyesoft/ngx-jsonapi","owner":"reyesoft","description":"JSON API client library for Angular 5+  👌 :: Production Ready 🚀","archived":false,"fork":false,"pushed_at":"2026-02-03T18:16:54.000Z","size":11628,"stargazers_count":101,"open_issues_count":65,"forks_count":50,"subscribers_count":10,"default_branch":"2.x","last_synced_at":"2026-02-04T02:45:06.673Z","etag":null,"topics":["angular","angular2","angular4","jsonapi","jsonapi-library","jsonapiclient"],"latest_commit_sha":null,"homepage":"https://ngx-jsonapi.reyesoft.com/","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/reyesoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-10-08T00:59:37.000Z","updated_at":"2025-04-23T21:31:32.000Z","dependencies_parsed_at":"2025-08-01T16:17:34.405Z","dependency_job_id":"75c38efd-7c60-4a94-b2f9-2398b723f8cc","html_url":"https://github.com/reyesoft/ngx-jsonapi","commit_stats":{"total_commits":162,"total_committers":18,"mean_commits":9.0,"dds":"0.49382716049382713","last_synced_commit":"6a50dc5c5489cfa1eb40a80e0b2c0bf771924917"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/reyesoft/ngx-jsonapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyesoft%2Fngx-jsonapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyesoft%2Fngx-jsonapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyesoft%2Fngx-jsonapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyesoft%2Fngx-jsonapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reyesoft","download_url":"https://codeload.github.com/reyesoft/ngx-jsonapi/tar.gz/refs/heads/2.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyesoft%2Fngx-jsonapi/sbom","scorecard":{"id":773153,"data":{"date":"2025-08-11","repo":{"name":"github.com/reyesoft/ngx-jsonapi","commit":"af62c8645e624c146efda0119bb4c683431f5427"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":8,"reason":"Found 19/23 approved changesets -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"121 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-3xgx-r9j4-qw9w","Warn: Project is vulnerable to: GHSA-3wcq-x3mq-6r9p","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-6h5x-7c5m-7cr7","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-8mmm-9v2q-x3f9","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-pc5p-h8pf-mvwp","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-jg8v-48h5-wgxg","Warn: Project is vulnerable to: GHSA-36fh-84j7-cv5h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442","Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc","Warn: Project is vulnerable to: GHSA-rqff-837h-mm52","Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2","Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j","Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-4fc4-chg7-h8gh","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T02:45:45.471Z","repository_id":25952311,"created_at":"2025-08-23T02:45:45.471Z","updated_at":"2025-08-23T02:45:45.471Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29130090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T18:55:47.139Z","status":"ssl_error","status_checked_at":"2026-02-05T18:55:04.010Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","angular4","jsonapi","jsonapi-library","jsonapiclient"],"created_at":"2024-09-25T01:24:57.235Z","updated_at":"2026-02-05T19:01:03.696Z","avatar_url":"https://github.com/reyesoft.png","language":"TypeScript","readme":"# ngx-jsonapi\n\n\u003cdiv align=\"center\"\u003e\n\n[![angular jsonapi](https://user-images.githubusercontent.com/938894/34119450-fa59fec0-e400-11e7-92c1-dd2aff2ebc00.png)](https://github.com/reyesoft/ngx-jsonapi)\n\n[![CircleCI](https://circleci.com/gh/reyesoft/ngx-jsonapi.svg?style=svg)](https://circleci.com/gh/reyesoft/ngx-jsonapi) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/b097196f7f544412a79a99080a41bbc1)](https://www.codacy.com/app/Swimlane/ngx-charts?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=swimlane/ngx-charts\u0026utm_campaign=Badge_Grade) [![npm version](https://badge.fury.io/js/ngx-jsonapi.png)](https://badge.fury.io/js/ngx-jsonapi) [![Coverage Status](https://coveralls.io/repos/github/reyesoft/ngx-jsonapi/badge.svg?branch=master)](https://coveralls.io/github/reyesoft/ngx-jsonapi?branch=master)\n\n\u003c/div\u003e\nThis is a JSON API library for Angular 6+. Please use [ts-angular-jsonapi](https://github.com/reyesoft/ts-angular-jsonapi) for AngularJS.\n\n## Online demo\n\nYou can test library on this online example 👌 \u003chttp://ngx-jsonapi.reyesoft.com/\u003e.\n\n\u003cdiv align=\"center\"\u003e\n\n[![demo app](https://user-images.githubusercontent.com/938894/39630783-c6f55ed4-4f86-11e8-9376-9acb587fe4c4.gif)](http://ngx-jsonapi.reyesoft.com/)\n\n\u003c/div\u003e\n\nData is obtained from [Json Api Playground](https://jsonapiplayground.reyesoft.com/) server.\n\n## Supported features\n\n-   Cache (on memory): TTL for collections and resources. Before a HTTP request objects are setted with cached data.\n-   Cache on IndexedDB\n-   Pagination\n-   Sorting\n-   [Include param support](http://jsonapi.org/format/#fetching-includes) (also, when you save)\n-   Equal requests, return a same ResourceObject on memory\n-   Default values for a new resource (hydrator).\n\n## Migration\n\n-   [Migration v1 to v2 update guide](https://github.com/reyesoft/ngx-jsonapi/blob/v2.0/docs/migration.md)\n\n## Usage\n\nJust [install](#installation), [configure](#dependecies-and-customization) and learn with [examples](#examples).\n\nFirst of all, it's advisable to read [Jsonapi specification](http://jsonapi.org/). Understanding JsonApi documents structure is recommended.\n\n### Installation\n\n```bash\nyarn add ngx-jsonapi@2.0.0-rc.4 --save\n# or npm if you wish...\n```\n\n### Dependecies and customization\n\n1.  Add Jsonapi dependency.\n2.  Configure your url and other paramemeters.\n3.  Inject JsonapiCore somewhere before you extend any class from `Jsonapi.Resource`.\n\n```typescript\n/* .. */\nimport { NgxJsonapiModule } from 'ngx-jsonapi';\n\n@NgModule({\n    imports: [\n        NgxJsonapiModule.forRoot({\n            url: '//jsonapiplayground.reyesoft.com/v2/'\n        })\n    ]\n})\nexport class AppModule {}\n```\n\n### Enable Local Cache\n\nLibrary cache anything memory. With Local Store, also store all on IndexDb on browser. Faster apps when we reuse a lot of data.\n\n```typescript\n/* .. */\nimport { NgxJsonapiModule } from 'ngx-jsonapi';\nimport { JSONAPI_RIPPER_SERVICE, JSONAPI_STORE_SERVICE } from './core';\nimport { StoreService } from 'ngx-jsonapi/sources/store.service';\nimport { JsonRipper } from 'ngx-jsonapi/services/json-ripper';\n\n@NgModule({\n    imports: [\n        NgxJsonapiModule.forRoot({\n            url: '//jsonapiplayground.reyesoft.com/v2/'\n        })\n    ],\n    providers: [\n        {\n            provide: JSONAPI_RIPPER_SERVICE,\n            useClass: JsonRipperFake\n        },\n        {\n            provide: JSONAPI_STORE_SERVICE,\n            useClass: StoreFakeService\n        }\n    ]\n})\nexport class AppModule {}\n```\n\n## Examples\n\nLike you know, the better way is with examples. Lets go! 🚀\n\n### Defining a resource\n\n`authors.service.ts`\n\n```typescript\nimport { Injectable } from '@angular/core';\nimport { Autoregister, Service, Resource, DocumentCollection, DocumentResource } from 'ngx-jsonapi';\nimport { Book } from '../books/books.service';\nimport { Photo } from '../photos/photos.service';\n\nexport class Author extends Resource {\n    public attributes = {\n        name: 'default name',\n        date_of_birth: ''\n    };\n\n    public relationships = {\n        books: new DocumentCollection\u003cBook\u003e(),\n        photo: new DocumentResource\u003cPhoto\u003e()\n    };\n}\n\n@Injectable()\n@Autoregister()\nexport class AuthorsService extends Service\u003cAuthor\u003e {\n    public resource = Author;\n    public type = 'authors';\n}\n```\n\n### Get a collection of resources\n\n#### Controller\n\n```typescript\nimport { Component } from '@angular/core';\nimport { DocumentCollection } from 'ngx-jsonapi';\nimport { AuthorsService, Author } from './../authors.service';\n\n@Component({\n    selector: 'demo-authors',\n    templateUrl: './authors.component.html'\n})\nexport class AuthorsComponent {\n    public authors: DocumentCollection\u003cAuthor\u003e;\n\n    public constructor(private authorsService: AuthorsService) {\n        authorsService\n            .all({\n                // include: ['books', 'photos'],\n            })\n            .subscribe(authors =\u003e (this.authors = authors));\n    }\n}\n```\n\n#### View for this controller\n\n```html\n\u003cp *ngFor=\"let author of authors.data; trackBy: authors.trackBy\"\u003e\n    id: {{ author.id }} \u003cbr /\u003e\n    name: {{ author.attributes.name }} \u003cbr /\u003e\n    birth date: {{ author.attributes.date_of_birth | date }}\n\u003c/p\u003e\n```\n\n#### Collection sort\n\nExample: `name` is a authors attribute, and makes a query like `/authors?sort=name,job_title`\n\n```typescript\nlet authors = authorsService.all({\n    sort: ['name', 'job_title']\n});\n```\n\n#### Collection filtering\n\nFilter resources with `attribute: value` values. Filters are used as 'exact match' (only resources with attribute value same as value are returned). `value` can also be an array, then only objects with same `attribute` value as one of `values` array elements are returned.\n\n```typescript\nauthorsService.all({\n    remotefilter: { country: 'Argentina' }\n});\n```\n\n### Get a single resource\n\nFrom this point, you only see important code for this library. For a full example, clone and see demo directory.\n\n```typescript\nauthorsService.get('some_author_id');\n```\n\n#### More options? Include resources when you fetch data (or save!)\n\n```typescript\nauthorsService.get('some_author_id', { include: ['books', 'photos'] });\n```\n\nTIP: these parameters work with `all()` and `save()` methods too.\n\n### Add a new resource\n\n```typescript\nlet author = this.authorsService.new();\nauthor.attributes.name = 'Pablo Reyes';\nauthor.attributes.date_of_birth = '2030-12-10';\nauthor.save();\n```\n\n#### Need you more control and options?\n\n```typescript\nlet author = this.authorsService.new();\nauthor.attributes.name = 'Pablo Reyes';\nauthor.attributes.date_of_birth = '2030-12-10';\n\n// some_book is an another resource like author\nlet some_book = booksService.get(1);\nauthor.addRelationship(some_book);\n\n// some_publisher is a polymorphic resource named company on this case\nlet some_publisher = publishersService.get(1);\nauthor.addRelationship(some_publisher, 'company');\n\n// wow, now we need detach a relationship\nauthor.removeRelationship('books', 'book_id');\n\n// this library can send include information to server, for atomicity\nauthor.save({ include: ['book'] });\n\n// mmmm, if I need get related resources? For example, books related with author 1\nlet relatedbooks = booksService.all({ beforepath: 'authors/1' });\n\n// you need get a cached object? you can force ttl on get\nlet author$ = authorsService.get(\n    'some_author_id',\n    { ttl: 60 } // ttl on seconds (default: 0)\n);\n```\n\n### Update a resource\n\n```typescript\nauthorsService.get('some_author_id').suscribe(author =\u003e {\n    this.author.attributes.name += 'New Name';\n    this.author.save(success =\u003e {\n        console.log('author saved!');\n    });\n});\n```\n\n### Pagination\n\n```typescript\nauthorsService.all({\n  // get page 2 of authors collection, with a limit per page of 50\n  page: { number: 2 ;  size: 50 }\n});\n```\n\n#### Collection page\n\n-   number: number of the current page\n-   size: size of resources per page ([it's sended to server by url](http://jsonapi.org/format/#fetching-pagination))\n-   information returned from server (check if is avaible) **total_resources: total of avaible resources on server** resources_per_page: total of resources returned per page requested\n\n## Local Demo App\n\nYou can run [JsonApi Demo App](http://ngx-jsonapi.reyesoft.com/) locally following the next steps:\n\n```bash\ngit clone git@github.com:reyesoft/ngx-jsonapi.git\ncd ngx-jsonapi\nyarn\nyarn start\n```\n\nWe use as backend [Json Api Playground](https://jsonapiplayground.reyesoft.com/).\n\n## Colaborate\n\nCheck [Environment development file](DEV_ENVIRONMENT.md) 😉.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freyesoft%2Fngx-jsonapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freyesoft%2Fngx-jsonapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freyesoft%2Fngx-jsonapi/lists"}