1.0.0-beta.1 • Published 5 years ago

tad-form-helpers v1.0.0-beta.1

Weekly downloads
4
License
-
Repository
-
Last release
5 years ago

tad-form-helpers

This library provides different pipes\directives for working with forms

Content List

  1. Scroll to invalid
  2. Resizing textarea
  3. Digit Only

Content

1. ScrollToInvalid

@Directive({
  selector: '[tadScrollToInvalid]'
})
export class ScrollToInvalidDirective

Directive applied to form. If form is invalid at the moment of submit directive scrolls to the first ivalid form's element.

Usage example

<form [tadScrollToInvalid]>
    ...
</form>

2. ResizingTextarea

@Directive({
   selector: '[tadResizingTextarea]'
 })
 export class ResizingTextareaDirective implements AfterViewInit

Library provides directive handles text area input resizing to fit text

Parameters

  • *minTextareaHeight: number* = 40 - restricts minimum height for textarea
  • *maxTextareaHeight: number* = 350 - restricts maximum height for textarea

Usage example

Component:

<textarea tadResizingTextarea [minTextareaHeight]="40" [maxTextareaHeight]="350">
    ...
</textarea>

3. DigitOnly

Library for restricting text input to numbers only

Parameters

  • *maxValue: number* - the maximum possible numerical value (if a larger number is entered, it will be reset to this value)
  • *minValue: number* = 0 - the smallest possible numerical value (if a lower number is entered, it will be reset to this value)
  • *truncZeros: boolean* = false - trim extra zeros before a number