0
我必須使用Angular將mouseenter上的按鈕內容更改爲ON,並將鼠標離開時的按鈕內容更改爲OFF。如何更改角度上的innerHTML內容onmouseout
<html ng-app="myApp" ng-controller="homeCtrl">
<head>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script>
var app = angular.module('myApp', []);
app.controller('homeCtrl', function ($scope) {
$scope.alert = function() {
this.myHTML = OFF;
};
$scope.text = function() {
this.myHTML = ON;
};
})
</script>
</head>
<body>
<button ng-mouseenter="alert();" ng-mouseleave="text();"> OFF </button>
</body>
</html>
您是否在「this」上測試了innerHTML屬性? –