{"id":20328129,"url":"https://github.com/Celtian/ngx-if-platform","last_synced_at":"2025-05-08T01:30:55.757Z","repository":{"id":40311521,"uuid":"412771275","full_name":"Celtian/ngx-if-platform","owner":"Celtian","description":"Directive for conditional display based on platform","archived":false,"fork":false,"pushed_at":"2025-04-14T08:36:27.000Z","size":1839,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-04T06:35:33.783Z","etag":null,"topics":["angular","library"],"latest_commit_sha":null,"homepage":"https://celtian.github.io/ngx-if-platform","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/Celtian.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-02T11:04:45.000Z","updated_at":"2025-04-14T08:36:31.000Z","dependencies_parsed_at":"2023-12-27T12:24:52.638Z","dependency_job_id":"8a33bc1a-105c-49de-9da9-d4fb820f11c0","html_url":"https://github.com/Celtian/ngx-if-platform","commit_stats":{"total_commits":64,"total_committers":2,"mean_commits":32.0,"dds":0.484375,"last_synced_commit":"644bb6e484b61693e55d542822ec799a5494bd62"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtian%2Fngx-if-platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtian%2Fngx-if-platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtian%2Fngx-if-platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Celtian%2Fngx-if-platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Celtian","download_url":"https://codeload.github.com/Celtian/ngx-if-platform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252981437,"owners_count":21835426,"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","library"],"created_at":"2024-11-14T20:00:58.002Z","updated_at":"2025-05-08T01:30:55.750Z","avatar_url":"https://github.com/Celtian.png","language":"TypeScript","funding_links":[],"categories":["Third Party Components"],"sub_categories":["Directives"],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Celtian/ngx-if-platform\" target=\"blank\"\u003e\u003cimg src=\"assets/logo.svg?sanitize=true\" alt=\"\" width=\"120\"\u003e\u003c/a\u003e\n  \u003ch1 align=\"center\"\u003eNgxIfPlatform\u003c/h1\u003e\n\u003c/p\u003e\n\n[![npm version](https://badge.fury.io/js/ngx-if-platform.svg)](https://badge.fury.io/js/ngx-if-platform)\n[![Package License](https://img.shields.io/npm/l/ngx-if-platform.svg)](https://www.npmjs.com/ngx-if-platform)\n[![NPM Downloads](https://img.shields.io/npm/dm/ngx-if-platform.svg)](https://www.npmjs.com/ngx-if-platform)\n[![Snyk](https://snyk.io/advisor/npm-package/ngx-if-platform/badge.svg)](https://snyk.io/advisor/npm-package/ngx-if-platform)\n[![codecov](https://codecov.io/gh/Celtian/ngx-if-platform/branch/master/graph/badge.svg?token=1IRUKIKM0D)](https://codecov.io/gh/celtian/ngx-if-platform/)\n[![stars](https://badgen.net/github/stars/celtian/ngx-if-platform)](https://github.com/celtian/ngx-if-platform/)\n[![forks](https://badgen.net/github/forks/celtian/ngx-if-platform)](https://github.com/celtian/ngx-if-platform/)\n[![HitCount](http://hits.dwyl.com/celtian/ngx-if-platform.svg)](http://hits.dwyl.com/celtian/ngx-if-platform)\n\n\u003e Angular directive for conditional display based on platform\n\n\u003e ✓ _Angular 19 compatible_\n\nHere's the [demo](http://celtian.github.io/ngx-if-platform/) or [stackblitz live preview](https://stackblitz.com/edit/ngx-if-platform) or [codesandbox live preview](https://codesandbox.io/s/ngx-if-platform-dgtck)\n\n- Lightweight\n- No dependencies!\n- Directive way\n\n## 🛠️ Install\n\n1. Use yarn (or npm) to install the package\n\n```terminal\nyarn add ngx-if-platform\n```\n\n2. Add `NgxIfPlatformModule` (or specific directive) into your `imports`\n\n```typescript\nimport { NgxIfPlatformModule } from 'ngx-if-platform';\n\n@Component({\n  standalone: true,\n  imports: [NgxIfPlatformModule /* , ... */],\n  // ...\n})\n```\n\nor\n\n```typescript\n  import { NgxIfPlatformModule } from 'ngx-if-platform';\n\n  @NgModule({\n   // ...\n   imports: [\n     // ...\n     NgxIfPlatformModule\n   ]\n  })\n```\n\n## 🚀 Quick start\n\n### Example code\n\n```html\n\u003c!-- ngxIf --\u003e\n\u003cdiv *ngxIfBrowser\u003eIs browser\u003c/div\u003e\n\u003c!-- ngxIf can be disabled  --\u003e\n\u003cng-template [ngxIfServer]=\"true\"\u003eIs server (disabled)\u003c/ng-template\u003e\n\u003c!-- ngxIf else statement  --\u003e\n\u003cng-template [ngxIfServer] [ngxIfNotServer]=\"notServer\"\u003eIs server\u003c/ng-template\u003e\n\u003cng-template #notServer\u003eNot server\u003c/ng-template\u003e\n```\n\n### Result\n\n```code\n  Is browser\n  Is server (disabled)\n  Not server\n```\n\n## 🛠️ Options\n\nThere are these directives: ngxIfBrowser, ngxIfServer, ngxIfWorkerApp, ngxIfWorkerUi\n\n### Directive \u0026 attributes\n\n| Option                | Type        | Default | Description                                |\n| --------------------- | ----------- | ------- | ------------------------------------------ |\n| **[ngxIfBrowser]**    | boolean     | true    | Directive can be disabled                  |\n| **[ngxIfNotBrowser]** | templateRef | none    | TemplateRef used if confition do not match |\n| **[ngxIfServer]**     | boolean     | true    | Directive can be disabled                  |\n| **[ngxIfNotServer]**  | templateRef | none    | TemplateRef used if confition do not match |\n\n## 🔧 Compatibility\n\n| Angular   | ngx-if-platform | Install                      |\n| --------- | --------------- | ---------------------------- |\n| \u003e= 18     | 3.x             | `yarn add ngx-if-platform`   |\n| \u003e= 14     | 2.x             | `yarn add ngx-if-platform@2` |\n| \u003e= 12     | 1.x             | `yarn add ngx-if-platform@1` |\n| \u003e= 5 \u003c 13 | 0.x             | `yarn add ngx-if-platform@0` |\n\n## 🪪 License\n\nCopyright \u0026copy; 2021 - 2025 [Dominik Hladik](https://github.com/Celtian)\n\nAll contents are licensed under the [MIT license].\n\n[mit license]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCeltian%2Fngx-if-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCeltian%2Fngx-if-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCeltian%2Fngx-if-platform/lists"}