# sml-ng-validation-service

> angular validation service

Latest version **1.0.3** (published 2021-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install sml-ng-validation-service
pnpm add sml-ng-validation-service
yarn add sml-ng-validation-service
bun add sml-ng-validation-service
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2021-03-17 |
| First published | 2021-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 36.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Muthulakshmi S |
| Maintainers | muthulakshmi |

## Links

- npm: https://www.npmjs.com/package/sml-ng-validation-service
- npm.io page: https://npm.io/package/sml-ng-validation-service

## Recent versions

- 1.0.3 (latest) — 2021-03-17
- 1.0.2 — 2021-03-17
- 1.0.1 — 2021-03-17
- 1.0.0 — 2021-03-17

## README

#Validation 
Angular validation service
--------------------------------

Overview
--------
A simple way to validate user input from the UI and display useful validation message , in both reactive forms and DOM Events.

Validations in sml-ng-validation-service
----------------------------------------
1.EmailId Validations 

2.PhoneNumber Validations 

3.PhoneNumber Masking 

4.Min length & Max length 

5.User Defined Regex - For example, we need to allow only 1 to 5 digit only in the input box, other digits should not allow to type. So we have to use this userDefinedRegex.
	Example : validation.userDefinedRegex($event,'1','5', true); 

6.notAllowedMaxLength - This method doesn't allowed to enter text not more than the defined length. 


----------------------------------------

Installation
------------

step1: npm i sml-ng-validation-service --save

_____________________________________________________
Step2: Import SmlNgValidationService into your app module


import {  SmlNgValidationServiceModule } from 'sml-ng-validation-service';


@NgModule({
  declarations: [

    AppComponent,
    SmlNgValidationServiceModule

  ],
  imports: [

    BrowserModule

  ],
  providers: [],

  bootstrap: [ AppComponent ]

})

export class AppModule { }

_____________________________________________________
step3: Import SmlNgValidationService into your component.ts


import { SmlNgValidationService } from 'sml-ng-validation-service';

constructor(
    private fb: FormBuilder,
    public validation: SmlNgValidationService
  ) { }
  
 ngOnInit() {

    this.smlNgValidationForm = this.fb.group({
      stringWithSpace: ['', Validators.required],
      regexDefined: ['', [Validators.required]],
      StrregexDefined: ['', [Validators.required]],
      lengthDefined: ['', [Validators.required, this.validation.MinMax('Integer', 2, 2)]],
      email: ['', [Validators.required, this.validation.EmailId()]],
      telephone: ['', [Validators.required, this.validation.PhoneNumber()]],
      sliceNthElement: ['']
    });

  }
______________________________________________________

DEMO:
---------
You can download and run it from your local.

github url : https://github.com/Muthulakshmisankar/sml-ng-validation-service/tree/master

_______________________________________________________________________________________

---
_Source: https://npm.io/package/sml-ng-validation-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
