This is my input:
<input type="number" value="{{ bom.Id._Value }}" name="id" data-ng-model="bom.Id._Value" data-ng-blur="myClass.myFunc();" required>
If I pass this
or angular.element(this)
in the ng-blur I don't get the input element in the function. What I want is to receive the current input element in myFunc() as a parameter. What is the standard way for it?
The ng-blur directive tells AngularJS what to do when an HTML element loses focus. The ng-blur directive from AngularJS will not override the element's original onblur event, both the ng-blur expression and the original onblur event will be executed.
A blur event fires when an element has lost focus. Note: As the blur event is executed synchronously also during DOM manipulations (e.g. removing a focussed input), AngularJS executes the expression using scope. $evalAsync if the event is fired during an $apply to ensure a consistent state.
jQuery blur() Method The blur event occurs when an element loses focus. The blur() method triggers the blur event, or attaches a function to run when a blur event occurs. Tip: This method is often used together with the focus() method.
The blur event fires when an element has lost focus. The event does not bubble, but the related focusout event that follows does bubble. The opposite of blur is the focus event, which fires when the element has received focus. The blur event is not cancelable.
<input type="number" value="{{ bom.Id._Value }}" name="id" data-ng-model="bom.Id._Value" data-ng-blur="myClass.myFunc($event);" required>
In Controller:
myClass.myFunc = function(e){
console.log(e.target);
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With