Partial value of the mask mask Ui

Hi for user interface mask in angularui, is there any way to capture part of the value from input field? For instance:

 <input type="text" name="myInput" ui-mask="999-999-9999"  placeholder="xxx-xxx-xxxx"class="form-control" data-ng-model="search.phone"   maxlength="12" ui-mask-use-viewvalue="true">

When I type 7783777826, it becomes 778-377-7826 (as indicated by the ui-mask syntax).

However, when I type 778377782 or 778377, the value is null. I want that even if the user enters these short values, I can at least capture them.

Is it possible to capture these partial values ​​via $ viewValue?

+4
source share
1 answer

uiMask , blurHandler, null, .

function blurHandler(){
  oldCaretPosition = 0;
  oldSelectionLength = 0;
   //if (!isValid || value.length === 0) {
   //  valueMasked = '';
   //  iElement.val('');
   //  scope.$apply(function (){
   //    controller.$setViewValue('');
   //  });
   //}
}

, - , , .

+3

Source: https://habr.com/ru/post/1534158/


All Articles