{"id":19368382,"url":"https://github.com/billcheng/a4-http","last_synced_at":"2025-07-01T05:03:40.873Z","repository":{"id":57171695,"uuid":"94601586","full_name":"billcheng/a4-http","owner":"billcheng","description":"Angular 4 Enhanced Http Service with Spinner \u0026 etc","archived":false,"fork":false,"pushed_at":"2017-06-17T05:56:32.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T05:03:16.994Z","etag":null,"topics":["angular","angular2","angular4","http","spinner"],"latest_commit_sha":null,"homepage":null,"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/billcheng.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}},"created_at":"2017-06-17T04:56:06.000Z","updated_at":"2017-06-17T05:05:08.000Z","dependencies_parsed_at":"2022-08-24T13:30:45.269Z","dependency_job_id":null,"html_url":"https://github.com/billcheng/a4-http","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/billcheng/a4-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billcheng%2Fa4-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billcheng%2Fa4-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billcheng%2Fa4-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billcheng%2Fa4-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/billcheng","download_url":"https://codeload.github.com/billcheng/a4-http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billcheng%2Fa4-http/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262900086,"owners_count":23381657,"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","angular4","http","spinner"],"created_at":"2024-11-10T08:06:15.886Z","updated_at":"2025-07-01T05:03:40.811Z","avatar_url":"https://github.com/billcheng.png","language":"TypeScript","readme":"# a4-http\nAngular 4 Enhanced Http Service\n\n# How-To\n## Install\n```\nnpm install a4-http\n```\n\n## app.module.ts\n1. Add ```HttpModule``` to imports of the ```app.module.ts```.\n\n```typescript\n\n...\nimport { HttpModule } from 'a4-http';\n...\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    ...,\n    HttpModule,\n    ...\n  ],\n  ...\n})\n```\n\n## Inject the service\n```typescript\nconstructor(private http: HttpService) { }\n```\n\n## Show/Hide the Spinner\n```typescript\nthis.http.setSpinner(\n    () =\u003e {\n        ... // show spinner code\n    }, () =\u003e {\n        ... // hide spinner code\n    }\n);\n```\n\n## get, post, put, patch \u0026 delete\n```typescript\npublic get(url: string, showSpinner?: boolean): Observable\u003cResponse\u003e;\npublic get(url: string, options?: any, showSpinner?: boolean): Observable\u003cResponse\u003e;\n\npublic post(url: string, body: any, showSpinner?: boolean): Observable\u003cResponse\u003e;\npublic post(url: string, body: any, options?: any, showSpinner?: boolean): Observable\u003cResponse\u003e;\n\npublic put(url: string, body: any, showSpinner?: boolean): Observable\u003cResponse\u003e;\npublic put(url: string, body: any, options?: any, showSpinner?: boolean): Observable\u003cResponse\u003e;\n\npublic patch(url: string, body: any, showSpinner?: boolean): Observable\u003cResponse\u003e;\npublic patch(url: string, body: any, options?: any, showSpinner?: boolean): Observable\u003cResponse\u003e;\n\npublic delete(url: string, showSpinner?: boolean): Observable\u003cResponse\u003e;\npublic delete(url: string, options?: any, showSpinner?: boolean): Observable\u003cResponse\u003e;\n```\n\n## redirect when error\n```typescript\nthis.http.setRedirect({\n      '-1': '/error',\n      0: '/signin',\n      401: '/signin',\n      403: '/signin'\n    });\n```\n1. Redirect to ```/signin``` if http status is 0, 401 or 403.\n1. '-1' is the default route if there is an error... '-1' is optional.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillcheng%2Fa4-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbillcheng%2Fa4-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillcheng%2Fa4-http/lists"}