FormsModule should be imported in app.module.shared #712

Closed
opened 2025-08-09 17:17:22 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @Gimly on 5/29/2017

I was having trouble understanding why, after passing my solution to Angular 4 (I re-run yeoman from the root of my solution and fixed all the issues), I was getting an error that said:

There is no directive with "exportAs" set to "ngForm"

I was very confused because this error comes when FormsModule isn't correctly imported, but it is imported in app.module.client. After a bit of testing, I figured out that the server-side (probably because of the pre-rendering) actually needed it as an import. I've passed the import to the app.module.shared and it fixed the issue.

Is there any reason for not importing FormsModule from the app.module.shared? Is there something that I should do differently to not have that issue?

*Originally created by @Gimly on 5/29/2017* I was having trouble understanding why, after passing my solution to Angular 4 (I re-run yeoman from the root of my solution and fixed all the issues), I was getting an error that said: > There is no directive with "exportAs" set to "ngForm" I was very confused because this error comes when `FormsModule` isn't correctly imported, but it is imported in app.module.client. After a bit of testing, I figured out that the server-side (probably because of the pre-rendering) actually needed it as an import. I've passed the import to the app.module.shared and it fixed the issue. Is there any reason for not importing `FormsModule` from the app.module.shared? Is there something that I should do differently to not have that issue?
fergalmoran added the 3 - Done3 - Done3 - Done3 - Done3 - Done labels 2025-08-09 17:17:23 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#712
No description provided.