Routing an Angular 2 app with Web API

后端 未结 2 802
一生所求
一生所求 2021-02-10 14:24

I have an Angular 2 application created with Angular CLI. This has to call a .NET 4.6 Web API. The route setup of this is driving me nuts.

For Angular, the default folde

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-10 15:21

    You need first disable web api routing for angular files, add this to web.config, inside :

    
      
        
          
          
            
            
            
          
          
        
      
    
    

    And then, add to your index.html.

    UPD: Rewrite access to index.html

    You can add another rewrite rule to override access to your /dist/ folder:

    
        
            
                
               
            
        
    
    

提交回复
热议问题