Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  5] [ 4]  / answers: 1 / hits: 81246  / 10 Years ago, tue, september 2, 2014, 12:00:00

i use angularjs and i have created a normal input field like this:



<input type=text style=border: none ng-model=model >


i want do the following:



if someone clicks in the input field, i want call for example method A. Then he writes text in this field and if the person clicks somewhere in my page so that the input field is no longer focused it should call method B. is this possible with angularjs ? if yes, how can i do that ?
ng-focus is only active at the input event but not at the output..



i want lock something with this, method A sets only a value to true and method B sets the same value to false. but i must know when the input field is active and when not.


More From » html

 Answers
7

You are looking at ng-focus and ng-blur.



<input type=text style=border: none ng-model=model ng-focus=A() ng-blur=B()>


On a side note, use css classes instead of inline styles.. :)



Or just call the same method with argument and set the value acc:-



 <input type=text style=border: none ng-model=model ng-focus=A(true) ng-blur=A(false)>

[#69581] Saturday, August 30, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
josuea

Total Points: 609
Total Questions: 121
Total Answers: 104

Location: South Georgia
Member since Fri, Nov 13, 2020
4 Years ago
josuea questions
;