UNPKG

1.81 kBJavaScriptView Raw
1import { Component } from '@angular/core';
2import { NavParams } from '../../navigation/nav-params';
3import { ViewController } from '../../navigation/view-controller';
4/** @hidden */
5var SelectPopover = (function () {
6 function SelectPopover(navParams, viewController) {
7 this.navParams = navParams;
8 this.viewController = viewController;
9 }
10 Object.defineProperty(SelectPopover.prototype, "value", {
11 get: function () {
12 var checkedOption = this.options.find(function (option) { return option.checked; });
13 return checkedOption ? checkedOption.value : undefined;
14 },
15 set: function (value) {
16 var checkedOption = this.options.find(function (option) { return option.value === value; });
17 if (checkedOption && checkedOption.handler) {
18 checkedOption.handler();
19 }
20 this.viewController.dismiss(value);
21 },
22 enumerable: true,
23 configurable: true
24 });
25 SelectPopover.prototype.ngOnInit = function () {
26 this.options = this.navParams.data.options;
27 };
28 SelectPopover.decorators = [
29 { type: Component, args: [{
30 template: "\n <ion-list radio-group [(ngModel)]=\"value\">\n <ion-item *ngFor=\"let option of options\">\n <ion-label>{{option.text}}</ion-label>\n <ion-radio [checked]=\"option.checked\" [value]=\"option.value\" [disabled]=\"option.disabled\"></ion-radio>\n </ion-item>\n </ion-list>\n "
31 },] },
32 ];
33 /** @nocollapse */
34 SelectPopover.ctorParameters = function () { return [
35 { type: NavParams, },
36 { type: ViewController, },
37 ]; };
38 return SelectPopover;
39}());
40export { SelectPopover };
41//# sourceMappingURL=select-popover-component.js.map
\No newline at end of file