Java 如何使用angular在单页应用程序中通过单击按钮重定向到另一个HTML页面?
我正在开发一个单页应用程序,其中包含登录和注册以及一些其他功能。我有一个页面Java 如何使用angular在单页应用程序中通过单击按钮重定向到另一个HTML页面?,java,html,angularjs,angularjs-ng-include,Java,Html,Angularjs,Angularjs Ng Include,我正在开发一个单页应用程序,其中包含登录和注册以及一些其他功能。我有一个页面index.html,其中包括signin.html和register.html,登录中的提交应该将用户引导到welcome.html。 我知道如何使用ng include将多个html页面放入一个页面,但在这种情况下如何使用它 尝试include.html <body ng-app="myApp"> <div > <div ng-include = "'tryinclude
index.html
,其中包括signin.html
和register.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>
您正在尝试1按“确定”转到另一页
好啊
tryinclude2.html:
<body>
<label>you are in tryinclude2 press ok to go to another page</label>
<button ng-include="'tryinclude1.html'">ok</button>
</body>
您正在尝试选择2按“确定”转到另一页
好啊
感谢您的帮助答案是使用ng hide和ng show,无需路由。 这里有更多细节
您可以使用ng view和ng route来管理单页应用程序
发布您已经尝试过的内容。如果您使用的是ui路由器,那么请使用$state.go('stateName')。如果您使用的是ng路由器,那么请使用$location.path('/newValue')。我发布了@Stark Buttowski查看中的
路由
概念angular@Stark非常感谢你,我现在更明白了