{"id":18614745,"url":"https://github.com/andrewjbateman/angular-fast-http-caching","last_synced_at":"2025-06-23T07:01:53.479Z","repository":{"id":40668438,"uuid":"162137205","full_name":"AndrewJBateman/angular-fast-http-caching","owner":"AndrewJBateman","description":":clipboard: Get data from a Github API and use observables for fast http caching. Tutorial from 'Demos with Angular'","archived":false,"fork":false,"pushed_at":"2023-02-04T06:52:06.000Z","size":1374,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T01:12:32.941Z","etag":null,"topics":["angular","angular15","cache-storage","html5","httpclient","observable","rxjs","rxjs7","tutorial","tutorial-code","typescript"],"latest_commit_sha":null,"homepage":"","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/AndrewJBateman.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-17T13:46:28.000Z","updated_at":"2022-12-30T10:56:59.000Z","dependencies_parsed_at":"2023-02-15T11:45:51.541Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/angular-fast-http-caching","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AndrewJBateman/angular-fast-http-caching","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-fast-http-caching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-fast-http-caching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-fast-http-caching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-fast-http-caching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/angular-fast-http-caching/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fangular-fast-http-caching/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261433936,"owners_count":23157196,"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","angular15","cache-storage","html5","httpclient","observable","rxjs","rxjs7","tutorial","tutorial-code","typescript"],"created_at":"2024-11-07T03:26:47.291Z","updated_at":"2025-06-23T07:01:48.462Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"TypeScript","readme":"# :zap: Angular Fast Http Caching\n\n* Uses HTTP Angular (asynchronous) Observables with RxJS (JS version of Reactive library) and browser local storage to show a locally cached version of API data.\n* Replaced by real data once the network request has completed.\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/angular-fast-http-caching?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/angular-fast-http-caching?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/angular-fast-http-caching?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/angular-fast-http-caching?style=plastic)\n\n## :page_facing_up: Table of contents\n\n* [:zap: Angular Fast Http Caching](#zap-angular-fast-http-caching)\n  * [:page_facing_up: Table of contents](#page_facing_up-table-of-contents)\n  * [:books: General info](#books-general-info)\n  * [:camera: Screenshots](#camera-screenshots)\n  * [:signal_strength: Technologies](#signal_strength-technologies)\n  * [:floppy_disk: Setup](#floppy_disk-setup)\n  * [:computer: Code Examples](#computer-code-examples)\n  * [:cool: Features](#cool-features)\n  * [:clipboard: Status \u0026 To-Do List](#clipboard-status--to-do-list)\n  * [:clap: Inspiration](#clap-inspiration)\n  * [:file_folder: License](#file_folder-license)\n  * [:envelope: Contact](#envelope-contact)\n\n## :books: General info\n\n* \"Observables are a new way of pushing data in JavaScript. An observable is a Producer of multiple values, “pushing” them to subscribers.\"\n* Shows github repos using a search term 'angular'.\n\n## :camera: Screenshots\n\n![Example screenshot](./img/fast-http-caching.png).\n\n## :signal_strength: Technologies\n\n* [Angular v15](https://angular.io/)\n* [RxJS Library v7](https://angular.io/guide/rx-library) used to handle datastreams and propagation of change using observables.\n* [RxJS startWith operator](http://reactivex.io/documentation/operators/startwith.html) used to emit a specified sequence of values before beginning to emit the items from the source Observable.\n* [The HttpClient in @angular/common/http](https://angular.io/guide/http) offers a simplified client HTTP API for Angular applications that rests on the XMLHttpRequest interface exposed by browsers.\n\n## :floppy_disk: Setup\n\n* `npm i` to install dependencies\n* Run `ng serve` for a dev server.\n* Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## :computer: Code Examples\n\n* `app.component.ts` _subscribe to github repo and use http caching_\n\n```typescript\nexport class AppComponent implements OnInit {\n  title = \"angular-fast-http-caching\";\n  repos: any;\n\n  constructor(private http: HttpClient) {}\n\n  ngOnInit() {\n    this.getRepos();\n  }\n\n  getRepos() {\n    const path = \"https://api.github.com/search/repositories?q=angular\";\n    this.repos = this.http.get\u003cany\u003e(path).pipe(map((data: any) =\u003e data.items));\n\n    this.repos.subscribe((next: any) =\u003e {\n      console.log(\"next data: \", next, typeof next); // type=object\n      localStorage[CACHE_KEY] = JSON.stringify(next); // store in local storage\n    });\n\n    this.repos = this.repos.pipe(\n      startWith(JSON.parse(localStorage[CACHE_KEY] || \"[]\"))\n    );\n  }\n}\n```\n\n## :cool: Features\n\n* An Angular HTTP Observable is combined with RxJS and the browser's local storage to automatically serve up a locally cached version that gets replaced by the real data as soon as the network request is finished.\n\n## :clipboard: Status \u0026 To-Do List\n\n* Status: Working.\n* To-Do: nothing.\n\n## :clap: Inspiration\n\n* [Youtube tutorial by 'Digital Fluency', Fast HTTP Caching With Angular HTTP Observables](https://www.youtube.com/watch?v=Yf1FfhMetjs\u0026t=535s).\n* [Luuk Gruijs, Medium article, \"Understanding, creating and subscribing to observables in Angular\"](https://medium.com/@luukgruijs/understanding-creating-and-subscribing-to-observables-in-angular-426dbf0b04a3)\n\n## :file_folder: License\n\n* This project is licensed under the terms of the MIT license.\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fangular-fast-http-caching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fangular-fast-http-caching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fangular-fast-http-caching/lists"}