繁体   English   中英

重定向到Index.html问题

[英]Redirect to Index.html issue

单击时,我想转到index.html,例如,如果用户单击浏览器中的重新加载图标,它将通过使用ng-click重定向到index.html。 如何在Angular JS中实现

HTML:

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

使用Javascript:

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM