polymer error on reloading

后端 未结 1 1234
抹茶落季
抹茶落季 2021-01-25 15:25

i have installed the polymer starter kit and once i load the starter kit every thing gets loaded properly and the url looks like http://127.0.0.1:8887/ then once i click on any

1条回答
  •  既然无缘
    2021-01-25 15:47

    When you refresh the page (http://127.0.0.1:8887/view1) you request the view1 resource from the server, but the server can't find it because there isn't. That path (.../view1) is only recognized by the polymer app itself and not the server.

    Try using hash in the path. Add the use-hash-as-path attribute to your app-location element inside the main page.

    So, it should look like this:

    
    

    EDIT

    It is not enough to add the use-hash-as-path property. You will also need to change slightly the href in the menu items.

    href="/view1" to href="#/view1"

    The code with more details:

    
    
    
    
    
      
      
        Menu
        
          View One
          View Two
          View Three
        
      
      ...
    
    

    0 讨论(0)
提交回复
热议问题