Skip to content

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

Closed
@patrickmichalina

Description

@patrickmichalina

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions