File

src/app/ui/erasable-input/erasable-input.component.ts

Implements

OnInit

Metadata

selector framadate-erasable-input
styleUrls ./erasable-input.component.scss
templateUrl ./erasable-input.component.html

Index

Methods
Inputs
Outputs

Constructor

constructor()

Inputs

inputModel

Outputs

inputModelChange
Type : EventEmitter

Methods

eraseInput
eraseInput()
Returns : void
ngOnInit
ngOnInit()
Returns : void
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';

@Component({
    selector: 'framadate-erasable-input',
    templateUrl: './erasable-input.component.html',
    styleUrls: ['./erasable-input.component.scss']
})
export class ErasableInputComponent implements OnInit {
    @Output() inputModelChange = new EventEmitter();

    @Input() inputModel;

    constructor() {
    }

    ngOnInit() {
    }

    eraseInput() {
        //
        this.inputModelChange.emit('');
        // TODO focus on other element
    }

}
<button
    class="erase btn btn--warning"
    *ngIf='inputModel.length'
    (click)="eraseInput()" >
    <i class="fa fa-times" ></i >
</button >

./erasable-input.component.scss

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""