@@ -34,7 +34,7 @@ export interface MdChipEvent {
3434
3535/** Event object emitted by MdChip when selected or deselected. */
3636export class MdChipSelectionChange {
37- constructor ( public source : MdChip , public isUserInput = false ) { }
37+ constructor ( public source : MdChip , public selected : boolean , public isUserInput = false ) { }
3838}
3939
4040
@@ -98,7 +98,11 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
9898 get selected ( ) : boolean { return this . _selected ; }
9999 set selected ( value : boolean ) {
100100 this . _selected = coerceBooleanProperty ( value ) ;
101- this . onSelectionChange . emit ( { source : this , isUserInput : false } ) ;
101+ this . selectionChange . emit ( {
102+ source : this ,
103+ isUserInput : false ,
104+ selected : value
105+ } ) ;
102106 }
103107
104108 /** The value of the chip. Defaults to the content inside <md-chip> tags. */
@@ -132,13 +136,25 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
132136 _onBlur = new Subject < MdChipEvent > ( ) ;
133137
134138 /** Emitted when the chip is selected or deselected. */
135- @Output ( ) onSelectionChange = new EventEmitter < MdChipSelectionChange > ( ) ;
139+ @Output ( ) selectionChange = new EventEmitter < MdChipSelectionChange > ( ) ;
136140
137141 /** Emitted when the chip is destroyed. */
138- @Output ( ) destroy = new EventEmitter < MdChipEvent > ( ) ;
142+ @Output ( ) destroyed = new EventEmitter < MdChipEvent > ( ) ;
143+
144+ /**
145+ * Emitted when the chip is destroyed.
146+ * @deprecated Use 'destroyed' instead.
147+ */
148+ @Output ( ) destroy = this . destroyed ;
139149
140150 /** Emitted when a chip is to be removed. */
141- @Output ( 'remove' ) onRemove = new EventEmitter < MdChipEvent > ( ) ;
151+ @Output ( ) removed = new EventEmitter < MdChipEvent > ( ) ;
152+
153+ /**
154+ * Emitted when a chip is to be removed.
155+ * @deprecated Use `removed` instead.
156+ */
157+ @Output ( 'remove' ) onRemove = this . removed ;
142158
143159 get ariaSelected ( ) : string | null {
144160 return this . selectable ? this . selected . toString ( ) : null ;
@@ -149,32 +165,50 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
149165 }
150166
151167 ngOnDestroy ( ) : void {
152- this . destroy . emit ( { chip : this } ) ;
168+ this . destroyed . emit ( { chip : this } ) ;
153169 }
154170
155171 /** Selects the chip. */
156172 select ( ) : void {
157173 this . _selected = true ;
158- this . onSelectionChange . emit ( { source : this , isUserInput : false } ) ;
174+ this . selectionChange . emit ( {
175+ source : this ,
176+ isUserInput : false ,
177+ selected : true
178+ } ) ;
159179 }
160180
161181 /** Deselects the chip. */
162182 deselect ( ) : void {
163183 this . _selected = false ;
164- this . onSelectionChange . emit ( { source : this , isUserInput : false } ) ;
184+ this . selectionChange . emit ( {
185+ source : this ,
186+ isUserInput : false ,
187+ selected : false
188+ } ) ;
165189 }
166190
167191 /** Select this chip and emit selected event */
168- selectViaInteraction ( ) {
192+ selectViaInteraction ( ) : void {
169193 this . _selected = true ;
170194 // Emit select event when selected changes.
171- this . onSelectionChange . emit ( { source : this , isUserInput : true } ) ;
195+ this . selectionChange . emit ( {
196+ source : this ,
197+ isUserInput : true ,
198+ selected : true
199+ } ) ;
172200 }
173201
174202 /** Toggles the current selected state of this chip. */
175203 toggleSelected ( isUserInput : boolean = false ) : boolean {
176204 this . _selected = ! this . selected ;
177- this . onSelectionChange . emit ( { source : this , isUserInput} ) ;
205+
206+ this . selectionChange . emit ( {
207+ source : this ,
208+ isUserInput,
209+ selected : this . _selected
210+ } ) ;
211+
178212 return this . selected ;
179213 }
180214
@@ -192,7 +226,7 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
192226 */
193227 remove ( ) : void {
194228 if ( this . removable ) {
195- this . onRemove . emit ( { chip : this } ) ;
229+ this . removed . emit ( { chip : this } ) ;
196230 }
197231 }
198232
@@ -210,7 +244,7 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
210244 }
211245
212246 /** Handle custom key presses. */
213- _handleKeydown ( event : KeyboardEvent ) {
247+ _handleKeydown ( event : KeyboardEvent ) : void {
214248 if ( this . disabled ) {
215249 return ;
216250 }
@@ -235,7 +269,7 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
235269 }
236270 }
237271
238- _blur ( ) {
272+ _blur ( ) : void {
239273 this . _hasFocus = false ;
240274 this . _onBlur . next ( { chip : this } ) ;
241275 }
@@ -266,7 +300,7 @@ export class MdChipRemove {
266300 constructor ( protected _parentChip : MdChip ) { }
267301
268302 /** Calls the parent chip's public `remove()` method if applicable. */
269- _handleClick ( ) {
303+ _handleClick ( ) : void {
270304 if ( this . _parentChip . removable ) {
271305 this . _parentChip . remove ( ) ;
272306 }
0 commit comments