2.0.0 • Published 3 years ago
@terminus/ui-validation-messages v2.0.0
Table of Contents
Installation
Packages that need to be installed
@angular/cdk
@angular/common
@angular/core
@angular/flex-layout
@angular/forms
@angular/material
@angular/platform-browser
@terminus/design-tokens
@terminus/fe-utilities
@terminus/ui-pipes
@terminus/ui-utilities
@terminus/ui-validation-messages
@terminus/ui-validators
date-fns
Use the ng add
command to quickly install all the needed dependencies:
ng add @terminus/ui-validation-messages
Modules that need to be in NgModule
TsValidationMessagesModule
CSS imports
In your top level stylesheet, add these imports:
@import '~@terminus/design-tokens/css/library-design-tokens.css';
@import '~@terminus/ui-styles/terminus-ui.css';
CSS resources
Load the needed font families by adding this link to the <head>
of your application:
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
Usage
This component was initially for internal use, but has been extended to support custom validation messages. Now a custom instance of this component can be passed in to override the existing validation messages.
<ts-validation-messages
<!-- This should be the same FormControl passed to the outer form component -->
[control]="myEmailControl"
<!-- This is the function that will determine the messaging for errors -->
[messagesFactory]="emailMessageFactory"
<!-- This directive is needed to help the parent TsFormField find the custom messages -->
tsCustomValidationMessage
></ts-validation-messages>
import { TsValidationMessageFactory } from '@terminus/ui-validation-messages';
...
emailMessageFactory: TsValidationMessageFactory = (a, b) => (a ? 'My custom message!' : null);
2.0.0
3 years ago
1.1.5
3 years ago
1.1.4
3 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.0.1
4 years ago