Im trying to create a custom directive, and bind it a specific div, however, I only can bind it to input, any way to bind it for divs?
link : function(scope, element, attrs) {
element.bind('input', function(e) {}); // works perfectly
element.bind('#myDiv', function(e) {}); //does not work!
}
Basically .bind
methods needs, the element on which you want to bind an event should be there on left on side
angular.element('#myDiv').bind('click', function(e) {});
Basically .bind
method takes an eventType
, eventData
& eventHandler
.bind( eventType [, eventData ], handler )
The code which you are saying working perfectly should not work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.