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

前端 未结 2 1737
情书的邮戳
情书的邮戳 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:03

    try to add this in you head tag.

    <html>
    <head>
        <base href="/VirtualDirectory/">
    </head>
    <body>
        ...
    </body>
    
    0 讨论(0)
  • 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"
            });
    
    0 讨论(0)
提交回复
热议问题