2017-04-19 47 views
0

我用角JS的foloowing庫:如何驗證angucomplete-alt中的輸入電子郵件?

https://github.com/ghiden/angucomplete-alt

如何驗證的電子郵件類型自動完成輸入?如果無效顯示錯誤?

我試圖用field-required="true",但ID不會對電子郵件驗證:

<angucomplete-alt 
           placeholder="<%= t('projects.project_full.invitation.enter_email_title') %>" 
           pause="100" 
           id="ex8b" 
           selected-object="selectedInvitationUsers" 
           local-data="invitable_users" 
           search-fields="fullname,email" 
           title-field="fullname,email" 
           minlength="1" 
           input-name="invite.email" 
           override-suggestions="true" 
           input-changed="inputChangeHandler" 
           field-required="true" 
           input-class="form-control form-control-small"/> 
         </div> 
+0

你在表單中包裹呢? https://ghiden.github.io/angucomplete-alt/#example8 – agriboz

+0

是的,我包裝了 – Daniel

回答

1

變化元件指令屬性的風格,如:

<div angucomplete-alt 
           placeholder="<%= t('projects.project_full.invitation.enter_email_title') %>" 
           pause="100" 
           id="ex8b" 
           selected-object="selectedInvitationUsers" 
           local-data="invitable_users" 
           search-fields="fullname,email" 
           title-field="fullname,email" 
           minlength="1" 
           input-name="invite.email" 
           override-suggestions="true" 
           input-changed="inputChangeHandler" 
           field-required="true" 
           input-class="form-control form-control-small"/> 
         </div>