Skip to content

Releases: Ninja-Squad/ngx-valdemort

v5.1.0

09 Apr 10:24
Compare
Choose a tag to compare

Features

  • add a validation fallback directive (d16d844), closes #264

The template of the valFallback directive is used for all the errors that exist on the form control but are not handled by any of the specific error templates:

<val-default-errors>
  <ng-template valError="required" let-label>{{ label }} is mandatory</ng-template>
  <ng-template valError="max" let-error="error" let-label>{{ label }} must be at most {{ error.max | number }}</ng-template>
  <ng-template valFallback let-label let-type="type" let-error="error">{{ label }} has an unhandled error of type {{ type }}: {{ error | json }}</ng-template>
</val-default-errors>
  • allow throwing on missing control (c2b739b)

This adds a configuration option called shouldThrowOnMissingControl that checks if the control is not found, if set to a function that returns true.
It is set to a function that returns false by default, so this is not breaking change.

This allows to catch situations where the controlName has been wrongly specified:

<input id="firstName" name="firstName" [(ngModel)]="user.firstName" #firstNameCtrl="ngModel" required/>
<!-- the control name mentions lastName whereas the control is firstName -->
<val-errors controlName="lastName" id="firstNameErrors">

In that case, if the new option is enabled, valdemort will throw:

ngx-valdemort: no control found for controlName: 'lastName'.

As the option accepts a function, it can easily be enabled in dev and tests, but disabled in production:

config.shouldThrowOnMissingControl = () => !environment.production;

v5.1.0-beta.1

09 Apr 10:26
Compare
Choose a tag to compare
v5.1.0-beta.1 Pre-release
Pre-release

Features

  • add a validation fallback directive (d16d844), closes #264

The template of the valFallback directive is used for all the errors that exist on the form control but are not handled by any of the specific error templates:

<val-default-errors>
  <ng-template valError="required" let-label>{{ label }} is mandatory</ng-template>
  <ng-template valError="max" let-error="error" let-label>{{ label }} must be at most {{ error.max | number }}</ng-template>
  <ng-template valFallback let-label let-type="type" let-error="error">{{ label }} has an unhandled error of type {{ type }}: {{ error | json }}</ng-template>
</val-default-errors>

v5.1.0-beta.0

09 Apr 10:25
Compare
Choose a tag to compare
v5.1.0-beta.0 Pre-release
Pre-release

Features

  • allow throwing on missing control (c2b739b)

This adds a configuration option called shouldThrowOnMissingControl that checks if the control is not found, if set to a function that returns true.
It is set to a function that returns false by default, so this is not breaking change.

This allows to catch situations where the controlName has been wrongly specified:

<input id="firstName" name="firstName" [(ngModel)]="user.firstName" #firstNameCtrl="ngModel" required/>
<!-- the control name mentions lastName whereas the control is firstName -->
<val-errors controlName="lastName" id="firstNameErrors">

In that case, if the new option is enabled, valdemort will throw:

ngx-valdemort: no control found for controlName: 'lastName'.

As the option accepts a function, it can easily be enabled in dev and tests, but disabled in production:

config.shouldThrowOnMissingControl = () => !environment.production;

v5.0.0

09 Apr 10:25
Compare
Choose a tag to compare

Features

⚠ BREAKING CHANGES

  • ngx-valdemort is now based on Angular 11.x. If you want to use it with an older version of Angular, then stick to the previous version of ngx-valdemort.

v4.0.0

26 Jun 10:27
Compare
Choose a tag to compare

Features

⚠ BREAKING CHANGES

  • ngx-valdemort is now based on Angular 10.x. If you want to use it with an older version of Angular, then stick to the previous version of ngx-valdemort.