Issue
I have a code snippit like so:
$('#myDiv').click(function(data) {
// call some method on my controller
});
Is there an 'Angular' way of doing this?
The sample above was poor. I actually want to be able to respond top the mouse up and mouse down events separately.
Answer
Angular has ngMousedown and ngMouseup directives..
Solution
Assuming you've defined the ng-app and what not for the page,
<div id="myDiv" ng-click="handleData(data")></div>
and in the controller for the app, define
$scope.handleData = function(data) { ... }
Answered By - Richard Kenny
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.