Microsoft provides a fantastic template for developing Angular (not AngularJS) in ASP.NET Core as outlined in their article "Building Single Page Applications on ASP.NET Core with JavaScriptServices".
While it's very straightforward, there is one portion of the template that caught me off guard: instead of there simply being an app.module.ts
file, there are both an app.module.client.ts
and an app.module.server.ts
.
I failed to find anything that explains this on the web. Does anyone have any idea why there are these two separate files for the app module, what their specific uses are, how to use them, etc.?
If it helps at all, here is what the full template looks like:
I should note that ClientApp/app/models
and ClientApp/app/services
are two folders I added for my own purposes; they are not part of the template. Also, app.module.shared.ts
is actually very straight-forward and just prevents having to write some code twice, so don't worry about it.
Here is what the two files look like: