ui select2 - Disable form submit on multiple ui-select for Angularjs -


when using multiple version of ui-select angularjs form submitted once user presses enter. many users start typing tag , press enter select , search new one. once users presses enter form submitted.

what best 'angular' way disabled this?

see example

<form ng-submit="submit()">   <ui-select multiple ng-model="multipledemo.colors" theme="select2"  style="width: 300px;">     <ui-select-match placeholder="select colors...">{{$item}}</ui-select-match>     <ui-select-choices repeat="color in availablecolors | filter:$select.search">       {{color}}     </ui-select-choices>   </ui-select>   <p>selected: {{multipledemo.colors}}</p>    <div style="height:500px"></div>   </form> 

if understand requirement, solution work you. please leave comment if want achieve else.

index.html

<ui-select ng-keypress="selec2_keypress($event)" multiple ng-model="multipledemo.colors" theme="select2"  style="width: 300px;"> 

demo.js

 $scope.selec2_keypress = function(event) {     if (event.which === 13)       event.preventdefault();   } 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -