AngularJS with MVC 6

前端 未结 2 1380
生来不讨喜
生来不讨喜 2021-01-23 06:59

This is an MVC 6/WebApi application. I\'m attempting to use WebApi on the backend with AngularJS on the frontend.

I have two static files: index.html

相关标签:
2条回答
  • 2021-01-23 07:32

    Okay, so since something didn't exist in the MVC 6/ASP.NET 5 framework, I've created my own middleware that provides a lot more flexibility. It has been added to GitHub and is available through NuGet.

    The project page is: https://github.com/a11smiles/AngularMiddleware

    0 讨论(0)
  • 2021-01-23 07:54

    I was able do what you are asking here. Basically, I added a catch all route to my index action:

    [Route("{*path}")]

    meaning if no MVC action does not exist, call my Index action and angular routing will take from there

    0 讨论(0)
提交回复
热议问题