今天用到ng-change事件,但是打印其$event时发现为undefined,网上找了些解释,以下为觉得解释的较为明白的。
ngChange is an directive, not an event-handler. The working is quite different. ngChange works by setting an scope.$watch, ngClick works by catching an event.
This behaviour is as documented, so this is a feature, not a bug.
I understand your confusion, it's an easily made mistake. If you want, you can create your own event handler using a (there is some irony here ;)) directive!
What is it you are trying to accomplish? Perhaps I can help you finding an alternative solution.
ngChange is an directive, not an event-handler. The working is quite different. ngChange works by setting an scope.$watch, ngClick works by catching an event.
This behaviour is as documented, so this is a feature, not a bug.
I understand your confusion, it's an easily made mistake. If you want, you can create your own event handler using a (there is some irony here ;)) directive!
What is it you are trying to accomplish? Perhaps I can help you finding an alternative solution.