gpt4 book ai didi

javascript - 在AngularJS中打开一个页面到另一页面

转载 作者:行者123 更新时间:2023-12-03 08:41:28 25 4
gpt4 key购买 nike

请告诉我如何使用链接在 Angular js 中显示其他页面,我使用了下面的代码,但它没有被打开

例如。

<form role="form" ng-submit="resetPassword()">
<div class="form-group">
<input type="password" class="form-control input-lg" id="username" ng-model="credential.password" placeholder="Password">
</div>
<div class="form-group">
<input type="password" class="form-control input-lg" id="password" ng-model="confirmPassword" placeholder="Confirm Password">
</div>
<button type="submit" class="btn btn-lg btn-primary btn-block">Submit</button>

<div class="form-group m-top15"> <a href="#/index.html">Sign in</a> </div>
</form>

最佳答案

您可以使用$window.location.href = '/index.html';

其中 $window 将是您的 Controller 依赖项之一。

如果你想使用链接,将使用ng-href

<a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>

引用: https://docs.angularjs.org/api/ng/directive/ngHref

关于javascript - 在AngularJS中打开一个页面到另一页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33037372/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com