I am develop Angular2 App with ASP.Net Core MVC and ASP.Net Web Api.
Here is my basic architecture.
ASP.Net Core MVC Project (MyProject.Web)
- Nuget, npm, and bower is used for dependencies. Bower is used to copy the npm dependencies from
node_modules
towwwroot/libs/
Home/Index
controller's action delivers the first page which loads Angular2 and other dependencies.- Templates are loaded from ActionMethods i.e.
Home/About
- SystemJS loads the modules.
- Angular2's http service calls the ASP.Net Web Api Project (a separate project than mvc)
ASP.Net Web Api Project (MyProject.Api) - Each Controllers is designated for CRUD operations of an entity, and responses to Angular2's http
Problem: I am not able to use HTML5 routing and am forced to hash routing because html5 routing calls the server and my MVC project does not have the corresponding controller. So server doesn't return anything.
index.html
for unknown URLs – Günter Zöchbauer Jan 14 at 14:53asset
directory (or distinguish by other criteria) – Günter Zöchbauer Jan 14 at 15:22