ionic-framework
Version:
78 lines (77 loc) • 2.5 kB
TypeScript
import { ElementRef, Renderer } from 'angular2/core';
import { NgControl } from 'angular2/common';
import { Ion } from '../ion';
import { Config } from '../../config/config';
/**
* @name Searchbar
* @module ionic
* @description
* Manages the display of a search bar which can be used to search or filter items.
*
* @usage
* ```html
* <ion-searchbar [(ng-model)]="defaultSearch"></ion-searchbar>
* ```
*
* @property [placeholder] - sets input placeholder to value passed in
* @property [show-cancel] - shows the cancel button based on boolean value passed in
* @property [cancel-text] - sets the cancel button text to the value passed in
* @property [cancel-action] - the function that gets called by clicking the cancel button
* @see {@link /docs/v2/components#search Search Component Docs}
*/
export declare class Searchbar extends Ion {
/**
* @private
* This holds the searchbar input value used for querying
*/
query: string;
constructor(elementRef: ElementRef, config: Config, ngControl: NgControl, renderer: Renderer);
/**
* @private
* After the view has initialized check if the searchbar has a value
* and then store that value in query
*/
ngAfterViewInit(): void;
/**
* @private
* Write a new value to the element.
*/
writeValue(value: any): void;
/**
* @private
* Set the function to be called when the control receives a change event.
*/
registerOnChange(fn: any): void;
/**
* @private
* Set the function to be called when the control receives a touch event.
*/
registerOnTouched(fn: any): void;
/**
* @private
* Updates the value of the control when the searchbar input changes.
*/
inputChanged(event: any): void;
/**
* @private
* Sets the searchbar to focused and aligned left on input focus.
*/
inputFocused(): void;
/**
* @private
* Sets the searchbar to not focused and checks if it should align left
* based on whether there is a value in the searchbar or not on input blur.
*/
inputBlurred(): void;
/**
* @private
* Clears the input field and triggers the control change.
*/
clearInput(event: any): void;
/**
* @private
* Blurs the input field, clears the input field and removes the left align
* then calls the custom cancel function if the user passed one in.
*/
cancelSearchbar(event: any, query: any): void;
}