Angular app on IIS 8.x virtual directory has strange URL behavior

前端 未结 2 1736
情书的邮戳
情书的邮戳 2021-02-05 18:45

I\'m having a problem with Angular JS on IIS 8.x with MVC. My application index page with virtual directory is like so:

https://myapp.xyz/VirtualDirectory/
         


        
2条回答
  •  不思量自难忘°
    2021-02-05 19:17

    I found that if you use the ./ syntax for the path, you don't need to involve Razor.

    Code which fails:

    $routeProvider.when("/productList", {
                templateUrl: "/app/products/productListView.html", controller: "ProductListController as vm"
            });
    

    Code that works: (note the . before /app)

    $routeProvider.when("/productList", {
                templateUrl: "./app/products/productListView.html", controller: "ProductListController as vm"
            });
    

提交回复
热议问题