{"id":13535459,"url":"https://github.com/hyzhak/ng2-safe-img","last_synced_at":"2025-06-24T21:37:07.227Z","repository":{"id":143505899,"uuid":"65328955","full_name":"hyzhak/ng2-safe-img","owner":"hyzhak","description":"very tiny and safe img for Angular 2","archived":false,"fork":false,"pushed_at":"2016-09-02T17:36:10.000Z","size":18,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-05-24T14:23:04.703Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/hyzhak.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-08-09T21:17:26.000Z","updated_at":"2023-11-20T11:28:26.000Z","dependencies_parsed_at":"2023-06-26T00:18:13.655Z","dependency_job_id":null,"html_url":"https://github.com/hyzhak/ng2-safe-img","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hyzhak/ng2-safe-img","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyzhak%2Fng2-safe-img","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyzhak%2Fng2-safe-img/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyzhak%2Fng2-safe-img/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyzhak%2Fng2-safe-img/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyzhak","download_url":"https://codeload.github.com/hyzhak/ng2-safe-img/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyzhak%2Fng2-safe-img/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261760092,"owners_count":23205658,"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":[],"created_at":"2024-08-01T08:00:56.792Z","updated_at":"2025-06-24T21:37:07.198Z","avatar_url":"https://github.com/hyzhak.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized","Awesome Angular [![Awesome TipeIO](https://img.shields.io/badge/Awesome%20Angular-@TipeIO-6C6AE7.svg)](https://github.com/gdi2290/awesome-angular) [![Awesome devarchy.com](https://img.shields.io/badge/Awesome%20Angular-@devarchy.com-86BDC1.svg)](https://github.com/brillout/awesome-angular-components)"],"sub_categories":["Uncategorized","Angular \u003ca id=\"angular\"\u003e\u003c/a\u003e"],"readme":"# ng2-safe-img [![Build Status](https://travis-ci.org/hyzhak/ng2-safe-img.svg?branch=develop)](https://travis-ci.org/hyzhak/ng2-safe-img)\nvery tiny and safe img for Angular 2\n\nJust consist from one structural directive - `*safeSrc`. \nAnd should be used with with \u003cimg/\u003e: \n\n```html\n\u003cimg *safeSrc=\"item.uri\"/\u003e\n```\n\n\n# Example\n\nLets explain how does it work through example.\n\nHere how should we use it \n\n```html\n\u003cimg *safeSrc=\"item.uri\"/\u003e\n```\n\nif \u003citem.uri\u003e equal to 'https://placekitten.com/200/300'\nwe will get\n\n```html\n\u003cimg src=\"https://placekitten.com/200/300\"/\u003e\n```\n\nif \u003citem.uri\u003e is undefined or null\nwe will get\n\n```html\n\u003c!--template bindings={\n  \"ng-reflect-src\": null\n}--\u003e\n```\n\nso no any html elements will be there. What saves us from seeing something like this:\n\n![unsafe img with undefined uri](unsafe-img-with-undefined-uri)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyzhak%2Fng2-safe-img","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyzhak%2Fng2-safe-img","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyzhak%2Fng2-safe-img/lists"}