question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSR Error: inject() must be called from an injection context

See original GitHub issue

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Render a mat-primary-button

What is the current behavior?

Fails to render on server, generating a Error: inject() must be called from an injection context error

What are the steps to reproduce?

Add material module to this repo and add a button to a random page

https://github.com/patrickmichalina/fusing-angular

Works fine on client, not server.

What is the use-case or motivation for changing an existing behavior?

To work on the server

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

"@angular/animations": "6.0.0-rc.0",
"@angular/cdk": "^6.0.0-beta.5",
"@angular/common": "6.0.0-rc.0",
"@angular/compiler": "6.0.0-rc.0",
"@angular/compiler-cli": "6.0.0-rc.0",
"@angular/core": "6.0.0-rc.0",
"@angular/forms": "6.0.0-rc.0",
"@angular/http": "6.0.0-rc.0",
"@angular/material": "^6.0.0-beta.5",
"@angular/platform-browser": "6.0.0-rc.0",
"@angular/platform-browser-dynamic": "6.0.0-rc.0",
"@angular/platform-server": "6.0.0-rc.0",
"@angular/router": "6.0.0-rc.0",
"@angular/service-worker": "6.0.0-rc.0",

Node 9.9.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
vikermancommented, Apr 3, 2018

This somehow seems to happen on second SSR render call in an example app I’m working with. Debugging…

0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

inject() must be called from an injection context - Stack Overflow
There seems to be an issue when using npm link when consuming the library. Solution: use projects.$name.architect.build.options.
Read more >
NG0203: `inject()` must be called from an injection context ...
You see this error when you try to use the inject() function outside of the allowed injection context. The injection context is available...
Read more >
How do I fix "Inject() must be called from an injection context"?
I had to enable "preserveSymLinks" in the Angular. json of the main project. 18 },
Read more >
error: inject() must be called from an injection context - You.com
There seems to be an issue when using npm link when consuming the library. Solution: use projects.$name.architect.build.options.
Read more >
Error: inject() must be called from an injection context | Angular
Error : inject() must be called from an injection context · Hi Vasili, · We have checking the diagram component with angular version...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found