简体   繁体   中英

Redirect to Index.html issue

On click i want to go to index.html for example if user click reload icon in browser it would redirect to index.html right samething by using ng-click. How to achieve this in 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";
  }
}

Use browsers native window.location object and its href property:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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