Exists
Ensures the value is exists in database GET, POST method is allowed for rmote validation. default method is GET.
#Directive Code Snippet
<!DOCTYPE html>
<html lang="en">
...
<form (ngSubmit)="onSubmit(form)" #form="ngForm">
<input [exists]="{url:<API_URL>,method:<method>}" type="text" name="<name>" [(ngModel)]="<name>" #<name>="ngModel">
</form>
...
</html>
#Config Options:
| Property | Type | Required | Description |
|---|---|---|---|
url |
string |
Yes | The endpoint URL to which the HTTP request will be sent. |
field |
string |
No | The specific field/property name to be used or mapped from the response. by default it will be the form name |
request |
object |
No | The request body/payload to be sent with the HTTP call. Typically used with POST requests. |
params |
object |
No | Query parameters to be appended to the URL (used with GET requests or additional filters). |
method |
'GET' | 'POST' |
No | The HTTP method to use for the request. Defaults to 'GET' if not specified. |