Skip to content
Advertisement

Tag: angular

Angular: serialize/unserialize in JSON HttpRequest and HttpResponse object

I want caching into the “localstorage” the HttpRequest and HttpResponse classes from @angular/common/http. The localstorage only accept string, therefore i want serialize/unserialize both objects (HttpRequest and HttpResponse) with JSON.stringfy() and JSON.parse(). The problem is HttpRequest and HttpResponse are both complex class with some ES6 Map (eg. HttpHeaders) and some getter/setter function, with JSON.stringfy() and JSON.parse() the serialization/unserialization don’t return the

Angular FormBuilder US Phone Number Regex (xxx) xxx-xxxx

I am trying to write an Angular Regex validator, which matches this and only this pattern for phone, spaces exact How can this be done? Working on this Code: Trying to add the space, after the first parenthesis, not sure if correct Answer You need to Add a literal space (or s to allow any whitespace) exactly at the location

Advertisement