tad-form-helpers
v1.0.0-beta.1
Published
This library provides different pipes\directives for working with forms
Downloads
3
Readme
tad-form-helpers
This library provides different pipes\directives for working with forms
Content List
- Scroll to invalid
- Resizing textarea
- Digit Only
Content
1. ScrollToInvalid
@Directive({
selector: '[tadScrollToInvalid]'
})
export class ScrollToInvalidDirectiveDirective 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 AfterViewInitLibrary 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
