AngularJS routing not working after site hosted into IIS

前端 未结 4 892
暗喜
暗喜 2020-12-18 10:17

We are creating SPA technique using AngularJS in ASP.NET MVC framework,AngularJS routing between pages are working fine when it\'s run from VS2013,but after hosting the appl

4条回答
  •  一向
    一向 (楼主)
    2020-12-18 10:53

    Are you deploying your solution as a website or as an application on a virtual path? In other words, when you deploy your app what is url? Is it something like "myapp.mydomain.com" or "domain.com/myapp"?

    If the latter, then the problem is that the request for the template { templateUrl: '/home/main' } will go to domain.com/home/main and not to domain.com/myapp/home/main when you expect it.

    According to : Stating directive templateUrl relative to root just remove '/' in the template url and it should work: { templateUrl: 'home/main' }

    The other option is to deploy your website to its own subdomain.

提交回复
热议问题