简体   繁体   中英

ng-submit with focus out event

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>

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>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM