From e19d4e38c08d532b3747ba85240d8e7a048acaba Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 27 Jan 2016 13:16:07 -0600 Subject: [PATCH] feat(select): emit change and select events Closes #5219 --- ionic/components/option/option.ts | 4 +++- ionic/components/select/select.ts | 17 ++++++++++------- .../select/test/multiple-value/index.ts | 8 +++++++- .../select/test/multiple-value/main.html | 2 +- .../select/test/single-value/index.ts | 4 ++++ .../select/test/single-value/main.html | 2 +- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ionic/components/option/option.ts b/ionic/components/option/option.ts index d1c0fca995..2ca37584f1 100644 --- a/ionic/components/option/option.ts +++ b/ionic/components/option/option.ts @@ -1,4 +1,4 @@ -import {Directive, ElementRef, Input} from 'angular2/core'; +import {Directive, ElementRef, Input, Output, EventEmitter} from 'angular2/core'; import {isDefined, isTrueProperty} from '../../util/util'; @@ -12,6 +12,8 @@ export class Option { private _checked: any = false; private _value; + @Output() select: EventEmitter = new EventEmitter(); + constructor(private _elementRef: ElementRef) {} @Input() diff --git a/ionic/components/select/select.ts b/ionic/components/select/select.ts index a1e1f192b8..b2dde622c6 100644 --- a/ionic/components/select/select.ts +++ b/ionic/components/select/select.ts @@ -1,4 +1,4 @@ -import {Component, Optional, ElementRef, Renderer, Input, HostListener, ContentChildren, QueryList} from 'angular2/core'; +import {Component, Optional, ElementRef, Renderer, Input, Output, EventEmitter, HostListener, ContentChildren, QueryList} from 'angular2/core'; import {NgControl} from 'angular2/common'; import {Alert} from '../alert/alert'; @@ -124,6 +124,8 @@ export class Select { @Input() disabled: boolean = false; @Input() multiple: string = ''; + @Output() change: EventEmitter = new EventEmitter(); + @ContentChildren(Option) options: QueryList