AngularJS 마우스 이벤트

· 8년 전 · 2222
AngularJS 마우스 이벤트

마우스 이벤트는 커서가 요소 위로 이동하면 다음 순서로 발생합니다.

ng-mouseenter
ng-mouseover
ng-mousemove
ng-mouseleave

또는 요소에서 마우스 버튼을 클릭하면 다음 순서대로 수행됩니다.

ng-mousedown
ng-mouseup
ng-click

모든 HTML 요소에 마우스 이벤트를 추가 할 수 있습니다.


마우스가 H1 요소 위로 이동할 때 카운트 변수를 증가시킵니다.

<div ng-app="myApp" ng-controller="myCtrl">

<h1 ng-mousemove="count = count + 1">Mouse over me!</h1>

<h2>{{ count }}</h2>

</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.count = 0;
});
</script>

예)
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="myApp" ng-controller="myCtrl">

<h1 ng-mousemove="count = count + 1">Mouse Over Me!</h1>

<h2>{{ count }}</h2>

</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.count = 0;
});
</script>

</body>
</html>
|
댓글을 작성하시려면 로그인이 필요합니다.

퍼블리싱강좌

+
분류 제목 글쓴이 날짜 조회
AngularJS 8년 전 조회 1,309
AngularJS 8년 전 조회 1,452
AngularJS 8년 전 조회 1,335
AngularJS 8년 전 조회 1,563
AngularJS 8년 전 조회 1,286
AngularJS 8년 전 조회 1,190
AngularJS 8년 전 조회 1,268
AngularJS 8년 전 조회 1,802
AngularJS 8년 전 조회 1,511
AngularJS 8년 전 조회 1,609
AngularJS 8년 전 조회 1,241
AngularJS 8년 전 조회 1,496
AngularJS 8년 전 조회 1,591
AngularJS 8년 전 조회 1,583
AngularJS 8년 전 조회 2,223
AngularJS 8년 전 조회 1,613
jQuery Mobile
[jQuery Mobile]
8년 전 조회 2,399
jQuery Mobile
[jQuery Mobile]
8년 전 조회 2,164
jQuery Mobile
[jQuery Mobile]
8년 전 조회 2,031
jQuery Mobile 8년 전 조회 1,926
jQuery Mobile
[jQuery Mobile]
8년 전 조회 1,971
jQuery Mobile
[jQuery Mobile]
8년 전 조회 2,200
jQuery Mobile
[jQuery Mobile]
8년 전 조회 1,719
jQuery Mobile
[jQuery Mobile]
8년 전 조회 1,793
jQuery Mobile 8년 전 조회 1,452
jQuery Mobile
[jQuery Mobile]
8년 전 조회 1,700
jQuery Mobile 8년 전 조회 1,937
jQuery Mobile 8년 전 조회 1,889
jQuery Mobile 8년 전 조회 2,094
jQuery Mobile 8년 전 조회 2,008