我还没有使用angularJS。我正在尝试使用按钮onclick功能导航到其他页面。
<html>
<head>
<script src="js/angular.min.js"></script>
</head>
<hello name="{{ name }}"></hello>
<p>
Start editing to see some magic happen :)
</p>
<body ng-app="myapp">
<div ng-controller="TestCtrl">
<button ng-click="clicked()">Click</button>
</div>
<script src="script.js"></script>
</body>
</html>
这是JS代码
var VLogin = angular.module('myapp',[]);
VLogin.controller('TestCtrl', function($scope) {
$scope.clicked = function(){
window.location = "#/index.html";
};
});
答案 0 :(得分:0)
尝试一下:
$scope.clicked = function(){
window.location.href = "#/index.html";
};