File

src/app/@theme/components/search-input/search-input.component.ts

Metadata

selector ngx-search-input
styleUrls search-input.component.scss
template
<i class="control-icon ion ion-ios-search"
   (click)="showInput()"></i>
<input placeholder="Type your search request here..."
       #input
       [class.hidden]="!isInputShown"
       (blur)="hideInput()"
       (input)="onInput($event)">

Index

Properties
Methods
Outputs

Outputs

search $event type: EventEmitter<string>

Methods

hideInput
hideInput()
Returns : void
onInput
onInput(val: string)
Parameters :
Name Type Optional
val string no
Returns : void
showInput
showInput()
Returns : void

Properties

input
input: ElementRef
Type : ElementRef
Decorators : ViewChild
isInputShown
isInputShown:
Default value : false
import { Component, ElementRef, EventEmitter, Output, ViewChild } from '@angular/core';

@Component({
  selector: 'ngx-search-input',
  styleUrls: ['./search-input.component.scss'],
  template: `
    <i class="control-icon ion ion-ios-search"
       (click)="showInput()"></i>
    <input placeholder="Type your search request here..."
           #input
           [class.hidden]="!isInputShown"
           (blur)="hideInput()"
           (input)="onInput($event)">
  `,
})
export class SearchInputComponent {
  @ViewChild('input') input: ElementRef;

  @Output() search: EventEmitter<string> = new EventEmitter<string>();

  isInputShown = false;

  showInput() {
    this.isInputShown = true;
    this.input.nativeElement.focus();
  }

  hideInput() {
    this.isInputShown = false;
  }

  onInput(val: string) {
    this.search.emit(val);
  }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""