### File

`projects/commons/src/lib/elements/email/components/email.component.ts`

### Extends

`Field`

### Implements

`OnInit`

### Metadata

selector | `cmn-email`
styleUrls | `./email.component.scss`
templateUrl | `./email.component.html`

### Index

###### Properties
Public form
###### Methods
Public ngOnInit Protected addFormValidator Public ngOnInit
###### Inputs
forceError icon label name placeholder size

### Constructor

`constructor(viewRef: ViewContainerRef)`
Defined in projects/commons/src/lib/elements/email/components/email.component.ts:19
Parameters :
Name | Type | Optional
viewRef | `ViewContainerRef` | No

### Inputs

forceError
Type : `boolean`
Defined in projects/commons/src/lib/elements/email/components/email.component.ts:18

icon
Type : `string`
Defined in projects/commons/src/lib/elements/email/components/email.component.ts:16

label
Type : `string`
Defined in projects/commons/src/lib/elements/email/components/email.component.ts:17

name
Type : `string`
Defined in projects/commons/src/lib/elements/email/components/email.component.ts:14

placeholder
Type : `string`
Defined in projects/commons/src/lib/elements/email/components/email.component.ts:19

size
Type : `string`
Defined in projects/commons/src/lib/elements/email/components/email.component.ts:15

### Methods

Public ngOnInit
`ngOnInit()`
Defined in projects/commons/src/lib/elements/email/components/email.component.ts:25
Returns : `void`

Protected addFormValidator
`addFormValidator(name: string, validators: Validators, value: string)`
Inherited from `Field`
Defined in `Field:17`
Parameters :
Name | Type | Optional | Default value
name | `string` | No |
validators | `Validators` | No |
value | `string` | No | `''`
Returns : `void`

Public ngOnInit
`ngOnInit()`
Inherited from `Field`
Defined in `Field:9`
Returns : `void`

### Properties

Public form
Type : `FormGroup`
Inherited from `Field`
Defined in `Field:5`

    import { Validators } from '@angular/forms';
    import { Component, Input, OnInit, ViewContainerRef } from '@angular/core';

    import { emailValidator } from '../validators';
    import { Field } from '../../../core/field/abstract';

    @Component({
        selector: 'cmn-email',
        templateUrl: './email.component.html',
        styleUrls: [ './email.component.scss', ],
    })

    export class EmailComponent extends Field implements OnInit {
        @Input() public readonly name: string;
        @Input() public readonly size: string;
        @Input() public readonly icon: string;
        @Input() public readonly label: string;
        @Input() public readonly forceError: boolean;
        @Input() public readonly placeholder: string;

        constructor(private readonly viewRef: ViewContainerRef) {
            super(viewRef);
        }

        public ngOnInit(): void {
            super.ngOnInit();

            this.addFormValidator(this.name, [ Validators.required, emailValidator ]);
        }
    }

    <div class="field">
        <label class="label"
               *ngIf="label">
            {{ label }}
        </label>
        <cmn-input [name]="name"
                   [size]="size"
                   [forceError]="forceError"
                   [placeholder]="placeholder"
                   [iconRight]="icon"
                   [formGroup]="form"
                   type="text">
        </cmn-input>
    </div>

`./email.component.scss`

Legend
Html element
Component
Html element with directive

# result-matching ""

# No results matching ""