{"id":15740176,"url":"https://github.com/marcjulian/astro-analog-inject","last_synced_at":"2025-03-31T04:52:06.483Z","repository":{"id":180220500,"uuid":"664768524","full_name":"marcjulian/astro-analog-inject","owner":"marcjulian","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-11T07:46:02.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T09:21:22.391Z","etag":null,"topics":[],"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/marcjulian.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":"2023-07-10T17:49:53.000Z","updated_at":"2023-07-10T18:14:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"528f9783-43a4-4c77-9246-f4356dd4622d","html_url":"https://github.com/marcjulian/astro-analog-inject","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.16666666666666663","last_synced_commit":"0a54cc0ae5c35bb022f24805a298d8ddf843920b"},"previous_names":["marcjulian/astro-analog-inject"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcjulian%2Fastro-analog-inject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcjulian%2Fastro-analog-inject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcjulian%2Fastro-analog-inject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcjulian%2Fastro-analog-inject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcjulian","download_url":"https://codeload.github.com/marcjulian/astro-analog-inject/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246418700,"owners_count":20773935,"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-10-04T02:20:18.308Z","updated_at":"2025-03-31T04:52:06.464Z","avatar_url":"https://github.com/marcjulian.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Astro Analog Inject Error\n\nStart the Astro dev server\n\n```bash\npnpm i\npnpm dev\n```\n\nVisit http://localhost:3000.\n\n## Inject Errow with `client:load` and external library\n\nTo see the error, uncomment the line 27 in [index.astro](./src/pages/index.astro). This error does not occur when the component is loaded with `client:only`.\n\n```\nERROR RuntimeError: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`. Find more at https://angular.io/errors/NG0203\n    at injectInjectorOnly (file:///Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@angular+core@16.1.4_rxjs@7.8.1_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:644:15)\n    at ɵɵinject (file:///Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@angular+core@16.1.4_rxjs@7.8.1_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:655:61)\n    at inject (file:///Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@angular+core@16.1.4_rxjs@7.8.1_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:738:12)\n    at \u003cinstance_members_initializer\u003e (file:///Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@rx-angular+template@16.0.1_@angular-devkit+core@16.1.4_@angular-devkit+schematics@16.1.4_@an_7pphcyfrbrlrlf32d6ab2nyjjq/node_modules/@rx-angular/template/fesm2022/template-let.mjs:52:24)\n    at new RxLet (file:///Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@rx-angular+template@16.0.1_@angular-devkit+core@16.1.4_@angular-devkit+schematics@16.1.4_@an_7pphcyfrbrlrlf32d6ab2nyjjq/node_modules/@rx-angular/template/fesm2022/template-let.mjs:50:1)\n    at NodeInjectorFactory.RxLet_Factory [as factory] (ng:///RxLet/ɵfac.js:5:10)\n    at getNodeInjectable (/Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@angular+core@16.1.4_rxjs@7.8.1_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:4662:44)\n    at instantiateAllDirectives (/Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@angular+core@16.1.4_rxjs@7.8.1_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:11590:27)\n    at createDirectivesInstances (/Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@angular+core@16.1.4_rxjs@7.8.1_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:11006:5)\n    at Module.ɵɵtemplate (/Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@angular+core@16.1.4_rxjs@7.8.1_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:15126:9) {\n  code: -203\n}\n...\n error   NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`. Find more at https://angular.io/errors/NG0203\n  File:\n    /Users/m/Dev/wip/astro-analog-inject/node_modules/.pnpm/@angular+core@16.1.4_rxjs@7.8.1_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:644:15\n  Code:\n    643 |     if (_currentInjector === undefined) {\n    \u003e 644 |         throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode \u0026\u0026\n          |               ^\n      645 |             `inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \\`runInInjectionContext\\`.`);\n      646 |     }\n      647 |     else if (_currentInjector === null) {\n  Stacktrace:\n```\n\n## Inject Error not thrown with directive in project\n\nA simple [LetDirective](./src/components/let.directive.ts) is used in the [PricingComponent](./src/components/pricing.component.ts) and no error is thrown when used in combination with `client:load`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcjulian%2Fastro-analog-inject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcjulian%2Fastro-analog-inject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcjulian%2Fastro-analog-inject/lists"}