$event Object angularjs

Posted 断弯刀

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了$event Object angularjs相关的知识,希望对你有一定的参考价值。

You can pass the $event object as an argument when calling the function.

The $event object contains the browser‘s event object:

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

<h1 ng-mousemove="myFunc($event)">Mouse Over Me!</h1>

<p>Coordinates: {{x + ‘, ‘ + y}}</p>

</div>
<script>
var app = angular.module(‘myApp‘, []);
app.controller(‘myCtrl‘, function($scope) {
    $scope.myFunc = function(myE) {
        $scope.x = myE.clientX;
        $scope.y = myE.clientY;
    }
});
</script>

 

以上是关于$event Object angularjs的主要内容,如果未能解决你的问题,请参考以下文章

AngularJS:ng-click 是“一个好习惯”吗?为啥AngularJS中没有ng-event?

angularJs--$on$emit和$broadcast的使用

$event.target 的 AngularJS 复选框 ng-change 问题

Part 39 AngularJS route change events

AngularJS服务总结

[[object Object]] 输入文本 angularjs