kolpak0860-register-form v2.0.0
RegisterForm
This library was generated with Angular CLI version 8.2.14.
Code scaffolding
Run ng generate component component-name --project register-form to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project register-form.
Note: Don't forget to add
--project register-formor else it will be added to the default project in yourangular.jsonfile.
Build
Run ng build register-form to build the project. The build artifacts will be stored in the dist/ directory.
Publishing
After building your library with ng build register-form, go to the dist folder cd dist/register-form and run npm publish.
Running unit tests
Run ng test register-form to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help or go check out the Angular CLI README.
Description
The form was implemented using custom value accessor NG_VALUE_ACCESSOR and NG_VALIDATORS
The registration form contains the following fields: firstName: '', Validators.required, lastName: '', Validators.required, amount: ['', Validators.required, Validators.min(20)], country: '', Validators.required
Getting started
At app.module.ts:
import { RegisterFormModule } from 'kolpak0860-register-form';
@NgModule({
imports: [RegisterFormModule],
})In component.html:
<form [formGroup]="signupForm" (ngSubmit)="onSubmit()">
<lib-register-form formControlName="register"></lib-register-form>
<div class="form-group">
<button (click)="onSubmit()" class="btn btn-primary">Register</button>
<a routerLink="/login" class="btn btn-link">Cancel</a>
</div>
</form>In component.ts: this.signupForm = this.fb.group({ register: [], });