AngularJS - Remove leading and trailing whitespace from input-box using regex

前端 未结 2 909
一生所求
一生所求 2020-11-29 13:23

I am writing a regular expression(regex) for adding multiple email ids in an input box with following conditions:

  1. Multiple email ids must be separated with com
2条回答
  •  广开言路
    2020-11-29 13:57

    AngularJS trims the input by default, so you need to use ng-trim="false" in order to pass leading and trailing whitespace to your pattern regex.

    See documentation:

    ngTrim (optional)

    If set to false Angular will not automatically trim the input. This parameter is ignored for input[type=password] controls, which will never trim the input.

    (default: true)

提交回复
热议问题