我想制作一个按钮,当我点击它时启动一个html页面。我该怎么做? 这是一个不完整的例子:
<button ng-model="status" ng-init="status=true" ng-click="status=!status">
<span ng-show="status == true" >Activo</span>
<span ng-show="status == false">Desactivo</span>
</button>
谢谢大家。
答案 0 :(得分:0)
你可以使用一个简单的&#39; a&#39;标签来解决这个问题:
<a href="somepage.html">Lunch somepage.html </a>
你也可以使用angularjs解决这个问题,这是一个例子:
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<button ng-model="status" ng-init="status=true" ng-click="myFunc()">
<span ng-show="status == true" >Activo</span>
<span ng-show="status == false">Desactivo</span>
</button>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $window) {
$scope.myFunc = function(){
$scope.status = !$scope.status;
$window.location.href = '/somepage.html'; //this will redirect you to somepage.html
}
});
</script>
</body>
</html>