html - javascript equivalent of anchor href -


let's webpage http://localhost/myapp/route/index.html

if click on:

  <li><a href="#secondpage">go second page</a></li> 

it change route http://localhost/myapp/route/index.html#/secondpage without reloading.

now i'm trying same thing onclick , javascript instead of anchor tag. because need first before let angular router change template.

  <li><a onclick="myfunction()">payroll run history</a></li>    myfunction(){       [... stuff ...]       //change http://localhost/myapp/route/index.html#/secondpage   without reloading page   } 

to set anchor property:

location.hash = "#/secondpage"; 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -