在angularjs中打开一页到其他页面

时间:2015-10-09 11:40:37

标签: javascript angularjs

Plz告诉我如何使用链接在角度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>

1 个答案:

答案 0 :(得分:1)

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

$window将成为您的控制器依赖项之一。

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

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

参见: https://docs.angularjs.org/api/ng/directive/ngHref