Routing and navigation in Angular 2

前端 未结 6 1486
误落风尘
误落风尘 2020-12-06 17:45

I am going through the tutorials for Angular 2 and have been able to get a simple application up and running. Now, I am moving on to the routing and navigation part found h

6条回答
  •  囚心锁ツ
    2020-12-06 18:29

    Old question, but I wanted to provide this suggestion as an alternative for future readers as I preferred the Rewrite method:

    Building upon the answers from stas.ivash and Adrian Moisa: I used their URL Rewrite suggestions, but instead of listing out routes, I modified the regex to route everything excluding the files that our Angular 2 CLI generated app needs, with the given extensions (.bundle.js, .bundle.map, etc...):

    
    
      
        
          
            
              
              
              
              
            
          
        
      
    
    

    I can't really speak to the performance implications of using this RegEx solution in a Production environment, but it works well for us on our Dev and Stage environments.

提交回复
热议问题