ngx-custom-validators icon indicating copy to clipboard operation
ngx-custom-validators copied to clipboard

Following URL is not valid: https://localhost:4200/xxx

Open bobKasbi opened this issue 5 years ago • 4 comments

Current behavior

When I add the following URL: https://localhost:4200/xxxxx in the text filed, the url is not valid.

Expected/desired behavior

This URL: https://localhost:4200/xxxxx should be valid and accepted by the validator

Environment information

Angular CLI: 8.3.8 Node: 12.13.0 OS: darwin x64 Angular: 8.2.14 NPM: 6.12.0 Typescript: 3.4.5

Other information

bobKasbi avatar Jan 30 '20 10:01 bobKasbi

AFAIK, this is not a valid url.

It's an alias of a IP, it should has a domain to be valid.

rsaenen avatar Jan 30 '20 10:01 rsaenen

Yes, it's endpoint of an API. We use a form input text to pass it to BE. Is there an attribute or HTML5 data-attribute for the input text to allow such kind of URL, or something similar?

Example: <input type="text" [(ngModel)]="model.field" name="field" #field="ngModel" data-url="validate-api-endpoint" url>

or: <input type="text" [(ngModel)]="model.field" name="field" #field="ngModel" data-url="allow-api-endpoint" url>

bobKasbi avatar Jan 30 '20 10:01 bobKasbi

Any news here? Would be great if it's possible to add a kind of options such: https://github.com/validatorjs/validator.js

bobKasbi avatar Feb 03 '20 14:02 bobKasbi

Ralf, I think if you allow any IP address, then localhost should be allowed too as it is a well known alias for 127.0.0.1.

Other the other sire, Bob, if you want, you can add in your /etc/hosts a FQDN with localhost as IP: e.g: www.bobkasbi.com 127.0.0.1 and use this "fake" FQDN in your code, rather than localhost.

kktos avatar Feb 08 '20 18:02 kktos