{"id":1773751,"url":"https://vadimdez.github.io/ng2-img-fallback","last_synced_at":"2025-03-05T19:30:42.672Z","repository":{"id":8936905,"uuid":"60298404","full_name":"VadimDez/ngx-img-fallback","owner":"VadimDez","description":"🖼 Load placeholder image on image error, Angular 5+","archived":false,"fork":false,"pushed_at":"2024-05-20T16:32:10.000Z","size":37750,"stargazers_count":82,"open_issues_count":5,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-17T18:45:02.641Z","etag":null,"topics":["angular","angular5","fallback","image","image-fallback","placeholder-image"],"latest_commit_sha":null,"homepage":"https://vadimdez.github.io/ngx-img-fallback/","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/VadimDez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"custom":["https://paypal.me/vadimdez"]}},"created_at":"2016-06-02T21:25:32.000Z","updated_at":"2024-07-18T12:05:58.000Z","dependencies_parsed_at":"2024-01-06T00:08:49.169Z","dependency_job_id":"30c1f42c-c49f-47c0-b427-8c733285fd1b","html_url":"https://github.com/VadimDez/ngx-img-fallback","commit_stats":{"total_commits":203,"total_committers":4,"mean_commits":50.75,"dds":0.3152709359605911,"last_synced_commit":"f1628ab1d253d1c5a5d40b50ba83e88f33733dd5"},"previous_names":["vadimdez/ng2-img-fallback"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-img-fallback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-img-fallback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-img-fallback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-img-fallback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VadimDez","download_url":"https://codeload.github.com/VadimDez/ngx-img-fallback/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242091208,"owners_count":20070294,"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","angular5","fallback","image","image-fallback","placeholder-image"],"created_at":"2024-01-19T04:35:43.815Z","updated_at":"2025-03-05T19:30:42.200Z","avatar_url":"https://github.com/VadimDez.png","language":"TypeScript","funding_links":["https://paypal.me/vadimdez","https://www.paypal.me/vadimdez"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"\u003ch1 align=\"center\"\u003eAngular 5+ Image Fallback\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/ngx-img-fallback\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/ngx-img-fallback.svg?style=flat\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://www.npmjs.com/package/ng2-img-fallback\"\u003e\n    \u003cimg src=\"https://badge.fury.io/js/ng2-img-fallback.svg\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://www.paypal.me/vadimdez\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Load placeholder image on image error\n\nAngular 5+ directive that loads placeholder image on primary image error.\n\n### Demo page\n\n[Demo page](https://vadimdez.github.io/ngx-img-fallback/)\n\n### Stackblitz Example\n\n[https://stackblitz.com/edit/ngx-img-fallback](https://stackblitz.com/edit/ngx-img-fallback)\n\n## Install\n\n```\nnpm install  ngx-img-fallback --save\n```\n\n*For Angular 2+ use version `1.2.0`*\n\n## Usage\n\n*In case you're using ```SystemJS``` see configuration [here](https://github.com/VadimDez/ngx-img-fallback/blob/master/SYSTEMJS.md)*\n\n\nAdd module to your module's ```imports```\n\n```typescript\nimport { NgModule } from '@angular/core';\nimport { BrowserModule  } from '@angular/platform-browser';\nimport { AppComponent } from './app';\n \nimport { ImgFallbackModule } from 'ngx-img-fallback';\n \n\n@NgModule({\n  imports: [\n    BrowserModule, \n    ImgFallbackModule\n  ],\n  declarations: [AppComponent],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {}\n```\n\nUse it in you component\n\n```typescript\nimport { Component } from '@angular/core';\n\n@Component({\n  selector: 'example-app',\n  template: '\u003cimg src=\"some_img.png\" src-fallback=\"{{ placeholder }}\"\u003e'\n})\nexport class AppComponent {\n  placeholder = 'http://placehold.it/200x200';\n}\n\n```\n\nSee also [example](https://github.com/VadimDez/ngx-img-fallback/tree/master/example) or [demo page](https://vadimdez.github.io/ngx-img-fallback/)\n\n## Events\n\n#### `(loaded)`\n\n`ngx-img-fallback` provides `(loaded)` event which is fired when either `src` or `src-fallback` is loaded.\nTo determinate whether original source or fallback is loaded - add a param to your callback for the `(loaded)` event.\n \nExample:\n\nFirst add callback to your component\n\n```typescript\nonLoaded(isFallback: boolean) {\n  // make somthing based on 'isFallback'\n}\n```\nand then bind it to the `loaded` event\n\n```html\n\u003cimg src=\"picture1.png\" src-fallback=\"picture2.png\" (loaded)=\"onLoaded($event)\"\u003e \n```\n\n## License\n\n[MIT](https://tldrlegal.com/license/mit-license) © [Vadym Yatsyuk](https://github.com/vadimdez)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/vadimdez.github.io%2Fng2-img-fallback","html_url":"https://awesome.ecosyste.ms/projects/vadimdez.github.io%2Fng2-img-fallback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/vadimdez.github.io%2Fng2-img-fallback/lists"}