0.0.23 • Published 8 months ago

mehrshad-core v0.0.23

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

MehrshadCore

This is a library for Angular projects that contains core assets and reusable features. It is designed to make your development easier and faster. The library is constantly updated with new features that are useful for many projects.

Features

  • Password match validator: A custom validator function that checks if the passwords in a form group match. It can be used in reactive forms to validate password and password retype fields.

Installation

To install this library, run:

$ npm install mehrshad-core --save

Usage

To use this library, you need to import it in your Angular module:

import {MehrshadCoreModule} from 'mehrshad-core';

@NgModule({
    imports: [
        // other imports ...
        MehrshadCoreModule,
    ],
    // ...
})
export class AppModule {}

Then, you can use the features of this library in your components. For example, to use the password match validator, you need to import it in your component:

import {passwordMatchValidator} from 'your-library-name';

Then, you can use it in your form group:

this.myForm = this.formBuilder.group({
    username: ['', Validators.required],
    passwordGroup: this.formBuilder.group(
        {
            password: ['', Validators.required],
            passwordRetype: ['', Validators.required],
        },
        {validators: [passwordMatchValidator]}
    ),
});

You can also display an error message if the passwords do not match:

<span *ngIf="myForm.get('passwordGroup')?.hasError('passwordMismatch')"
    >error<span></span
></span>

Documentation

For more details you can give me a message on Telegram

License

This library is licensed under the MIT License. See the MIT License file for more information.

0.0.23

8 months ago

0.0.22

8 months ago

0.0.21

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago