簡體   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