Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/383.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用angular在单页应用程序中通过单击按钮重定向到另一个HTML页面?_Java_Html_Angularjs_Angularjs Ng Include - Fatal编程技术网

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非常感谢你,我现在更明白了