AngularJS with MVC 6

前端 未结 2 1381
生来不讨喜
生来不讨喜 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: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

提交回复
热议问题