Search code examples
javahtmlangularjsangularjs-ng-include

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


Solution

  • 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