简体   繁体   中英

How to redirect to another HTML page by button click in a single page app using angular?

I am working on a single page application that contains sign in and registration and some other functionalities.I have page index.html that includes signin.html and register.html ,and the submit in the sign in should direct the user to welcome.html . I understand how to use ng-include to put many html pages into one page but how can I use it in this situation ?

try include.html

<body  ng-app="myApp">
  <div >
     <div ng-include = "'tryinclude1.html'"></div>
  </div>

tryinclude1.html

<body>
<label>you are in tryinclude1 press ok to go to another page</label>
<button ng-include="'tryinclude1.html'">ok</button>
</body>

tryinclude2.html:

<body>
<label>you are in tryinclude2 press ok to go to another page</label>
<button ng-include="'tryinclude1.html'">ok</button>
</body>

Thank you for helping

the answer is to use ng-hide and ng-show ,with no need for routing. more detail here https://scotch.io/tutorials/how-to-use-ngshow-and-nghide

You can use ng-view and ng-route to manage your single page application.

https://docs.angularjs.org/api/ngRoute/directive/ngView

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM