0

In angularjs i have created a form on page ... when i enter text in input and press enter then ng-submit method is called , is there any method to call method on focus out Event.

Fiddle Code:: http://fiddle.jshell.net/Lyz6z/

 <form ng-submit="submit(user.name,user.selectedOption)" class="data-dz-tag" >
      <br/><input type="text" placeholder="Caption" ng-model="user.name" name="text" style="width:125px" /><br/>
     <select ng-model="user.selectedOption" ng-options="option.name for option in options">{{option.name}}
    </select>
</form>
anam
  • 3,905
  • 16
  • 45
  • 85

1 Answers1

1

I solved this problem by Adding ng-blur .

 <form ng-submit="submit(user.name,user.selectedOption)" class="data-dz-tag" >
<select ng-model="user.selectedOption" ng-options="option.name for option in options">
    {{option.name}}
</select>
<input type="text" placeholder="Caption" ng-model="user.name" name="text" style="width:125px" ng-blur="submit(user)"/>
<br/>
</form>
anam
  • 3,905
  • 16
  • 45
  • 85
  • 1
    Good :) let me know if you need anything else – K D Jun 25 '14 at 11:33
  • I did this too, but now I have the problem of submit being called twice, once on enter press and once after when user blurs the textfield. Any advice? – Max Strater Dec 19 '14 at 22:43