重定向到Index.html问题

时间:2014-11-18 10:52:46

标签: javascript angularjs

点击后我想转到index.html,例如,如果用户点击浏览器中的重新加载图标,它将通过使用ng-click重定向到index.html。 如何在角度js

中实现这一点

HTML:

<div ng="logoutcntrl">
    <ons-button ng-click="logout()"></ons-button>
</div>

使用Javascript:

function logoutcntrl($scope){
  $scope.logout= function(){
    $location.path="index.html";
  }
}

1 个答案:

答案 0 :(得分:0)

使用浏览器本机window.location对象及其href属性:

function logoutcntrl($scope) {
  $scope.logout= function() {
    window.location.href = "index.html";
  }
}