如何使用 angular 通过单击单页应用程序中的按钮重定向到另一个 HTML 页面?

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

我正在开发一个包含登录和注册的单页应用程序,其他一些 functionalities.I 的页面 index.html 包括 signin.htmlregister.html,并且在登录中提交应将用户定向到 welcome.html。 我了解如何使用 ng-include 将许多 html 页放入一页,但在这种情况下我该如何使用它?

尝试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>

感谢您的帮助

答案是使用ng-hide和ng-show,不需要路由。 更多细节在这里 https://scotch.io/tutorials/how-to-use-ngshow-and-nghide

您可以使用 ng-view 和 ng-route 来管理您的单页应用程序。

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