点击后我想转到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";
}
}
答案 0 :(得分:0)
使用浏览器本机window.location
对象及其href
属性:
function logoutcntrl($scope) {
$scope.logout= function() {
window.location.href = "index.html";
}
}