Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-change doesn't get the $event argument #6370

Closed
edriang opened this issue Feb 20, 2014 · 3 comments

Comments

@edriang
Copy link

@edriang edriang commented Feb 20, 2014

When you attach a listener to a radio button with ng-change yout can't pass an $event argument.

If I change ng-change to ng-click it does the trick, but it will be better if $event is available for the different event-listeners defined by angular directives

@caitp

This comment has been minimized.

Copy link
Contributor

@caitp caitp commented Feb 20, 2014

ng-change is not a directive for handling the change event (I realize that this is confusing given the name), but is actually instead notified when ngModelController.$setViewValue() is called and the value changes (because ng-change adds a listener to the $viewChangeListeners collection). So this is as expected.

@NickChristensen

This comment has been minimized.

Copy link

@NickChristensen NickChristensen commented Jan 20, 2015

So sorry to resurrect this @caitp , but could you point me in the right direction if I wanted to handle (and possibly preventDefault) a change event? Specifically thinking about a <select>

@caitp

This comment has been minimized.

Copy link
Contributor

@caitp caitp commented Jan 20, 2015

use jQuery#on() or jqLite#on() to bind event listeners, and call preventDefault() if you need to

asfgit pushed a commit to apache/zeppelin that referenced this issue May 4, 2017
### What is this PR for?
`ng-change` can not capture event, so that means `$event.timeStamp` is undefined. angular/angular.js#6370
This cause AngularElem's onChange is only invoked once. This PR use another approach to update the angularObject.

### What type of PR is it?
[Bug Fix]

### Todos
* [ ] - Task

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-2486

### How should this be tested?
Tested manually

### Screenshots (if appropriate)

Before
![zeppelin_before](https://cloud.githubusercontent.com/assets/164491/25662178/227ec2ec-3046-11e7-9852-9e041d008698.gif)
After
![zeppelin_after](https://cloud.githubusercontent.com/assets/164491/25662177/2108e898-3046-11e7-816f-7685480df83e.gif)
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Jeff Zhang <zjffdu@apache.org>

Closes #2312 from zjffdu/ZEPPELIN-2486 and squashes the following commits:

4039d6b [Jeff Zhang] ZEPPELIN-2486. AngularElem's onChange is only invoked once
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.