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
Methods
Inputs

Constructor

constructor(viewRef: ViewContainerRef)
Parameters :
Name Type Optional
viewRef ViewContainerRef No

Inputs

forceError
Type : boolean
icon
Type : string
label
Type : string
name
Type : string
placeholder
Type : string
size
Type : string

Methods

Public ngOnInit
ngOnInit()
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 ""