0
I need to apply a mask that formats both landline and phone.
I tried to:
<input [pattern]="customPatterns" type="text" class="form-control" id="numero" name="numero" [(ngModel)]="empresa.numero">
and in the component:
public customPatterns = { pattern: new RegExp(/^(?:(?:\+|00)?(55)\s?)?(?:\(?([1-9][0-9])\)?\s?)?(?:((?:9\d|[2-9])\d{3})\-?(\d{4}))$/)};
But I get:
RROR Typeerror: regex.test is not a Function
There is a mixture of English and Portuguese in your reply or is it my impression?
– RXSD
It is an excerpt from the ngx-Mask lib
– Tiago
But if not, try removing the object from the customPatterns: public customPatterns = new Regexp(/ (?: (?:+| 00)? (55) s? )? (?: (? ([1-9][0-9]))?\ s? )? (?: ((?: 9\d|[2-9])\d{3})-? (\d{4}))$/);
– Tiago