ionic-framework
Version:
The ionic-framework package comes with both Javascript and Sass frontend dependencies, located in the root of the package, and a Node API, located in `tooling/`.
135 lines (134 loc) • 4.15 kB
TypeScript
import { ElementRef, Renderer, EventEmitter, QueryList } from 'angular2/core';
import { NgControl } from 'angular2/common';
/**
* @name SegmentButton
* @description
* The child buttons of the `ion-segment` component. Each `ion-segment-button` must have a value.
* @property {string} [value] - the value of the segment-button. Required.
* @usage
* ```html
* <ion-segment [(ngModel)]="relationship" primary>
* <ion-segment-button value="friends" (select)="selectedFriends()">
* Friends
* </ion-segment-button>
* <ion-segment-button value="enemies" (select)="selectedEnemies()">
* Enemies
* </ion-segment-button>
* </ion-segment>
*```
*
* Or with `FormBuilder`
*
*```html
* <form [ngFormModel]="myForm">
* <ion-segment ngControl="mapStyle" danger>
* <ion-segment-button value="standard">
* Standard
* </ion-segment-button>
* <ion-segment-button value="hybrid">
* Hybrid
* </ion-segment-button>
* <ion-segment-button value="sat">
* Satellite
* </ion-segment-button>
* </ion-segment>
* </form>
* ```
*
* @property {Any} [click] - expression to evaluate when a segment button has been clicked
*
* @demo /docs/v2/demos/segment/
* @see {@link /docs/v2/components#segment Segment Component Docs}
* @see {@link /docs/v2/api/components/segment/Segment/ Segment API Docs}
*/
export declare class SegmentButton {
private _renderer;
private _elementRef;
value: string;
select: EventEmitter<SegmentButton>;
constructor(_renderer: Renderer, _elementRef: ElementRef);
/**
* @private
* On click of a SegmentButton
*/
private onClick(ev);
/**
* @private
*/
ngOnInit(): void;
/**
* @private
*/
isActive: any;
}
/**
* @name Segment
* @description
* A Segment is a group of buttons, sometimes known as Segmented Controls, that allow the user to interact with a compact group of a number of controls.
* Segments provide functionality similar to tabs, selecting one will unselect all others. You should use a tab bar instead of a segmented control when you want to let the user move back and forth between distinct pages in your app.
* You could use Angular 2's `ngModel` or `FormBuilder` API. For an overview on how `FormBuilder` works, checkout [Angular 2 Forms](http://learnangular2.com/forms/), or [Angular FormBuilder](https://angular.io/docs/ts/latest/api/common/FormBuilder-class.html)
*
*
* @usage
* ```html
* <ion-segment [(ngModel)]="relationship" (change)="onSegmentChanged($event)" danger>
* <ion-segment-button value="friends">
* Friends
* </ion-segment-button>
* <ion-segment-button value="enemies">
* Enemies
* </ion-segment-button>
* </ion-segment>
*```
*
* Or with `FormBuilder`
*
*```html
* <form [ngFormModel]="myForm">
* <ion-segment ngControl="mapStyle" danger>
* <ion-segment-button value="standard">
* Standard
* </ion-segment-button>
* <ion-segment-button value="hybrid">
* Hybrid
* </ion-segment-button>
* <ion-segment-button value="sat">
* Satellite
* </ion-segment-button>
* </ion-segment>
* </form>
* ```
*
* @property {Any} [change] - expression to evaluate when a segment button has been changed
*
* @demo /docs/v2/demos/segment/
* @see {@link /docs/v2/components#segment Segment Component Docs}
* @see [Angular 2 Forms](http://learnangular2.com/forms/)
*/
export declare class Segment {
value: string;
onChange: (_: any) => void;
onTouched: (_: any) => void;
change: EventEmitter<SegmentButton>;
_buttons: QueryList<SegmentButton>;
constructor(ngControl: NgControl);
/**
* @private
* Write a new value to the element.
*/
writeValue(value: any): void;
/**
* @private
*/
ngAfterViewInit(): 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;
}