@@ -45,9 +45,7 @@ import {
4545} from '@angular/material/core' ;
4646import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations' ;
4747import {
48- MAT_CHECKBOX_CLICK_ACTION ,
4948 MAT_CHECKBOX_DEFAULT_OPTIONS ,
50- MatCheckboxClickAction ,
5149 MatCheckboxDefaultOptions
5250} from './checkbox-config' ;
5351
@@ -202,13 +200,6 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
202200 private _focusMonitor : FocusMonitor ,
203201 private _ngZone : NgZone ,
204202 @Attribute ( 'tabindex' ) tabIndex : string ,
205- /**
206- * @deprecated `_clickAction` parameter to be removed, use
207- * `MAT_CHECKBOX_DEFAULT_OPTIONS`
208- * @breaking -change 10.0.0
209- */
210- @Optional ( ) @Inject ( MAT_CHECKBOX_CLICK_ACTION )
211- private _clickAction : MatCheckboxClickAction ,
212203 @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) public _animationMode ?: string ,
213204 @Optional ( ) @Inject ( MAT_CHECKBOX_DEFAULT_OPTIONS )
214205 private _options ?: MatCheckboxDefaultOptions ) {
@@ -220,9 +211,6 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
220211 }
221212
222213 this . tabIndex = parseInt ( tabIndex ) || 0 ;
223-
224- // TODO: Remove this after the `_clickAction` parameter is removed as an injection parameter.
225- this . _clickAction = this . _clickAction || this . _options . clickAction ;
226214 }
227215
228216 ngAfterViewInit ( ) {
@@ -398,6 +386,8 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
398386 * @param event
399387 */
400388 _onInputClick ( event : Event ) {
389+ const clickAction = this . _options ?. clickAction ;
390+
401391 // We have to stop propagation for click events on the visual hidden input element.
402392 // By default, when a user clicks on a label element, a generated click event will be
403393 // dispatched on the associated input element. Since we are using a label element as our
@@ -408,9 +398,9 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
408398 event . stopPropagation ( ) ;
409399
410400 // If resetIndeterminate is false, and the current state is indeterminate, do nothing on click
411- if ( ! this . disabled && this . _clickAction !== 'noop' ) {
401+ if ( ! this . disabled && clickAction !== 'noop' ) {
412402 // When user manually click on the checkbox, `indeterminate` is set to false.
413- if ( this . indeterminate && this . _clickAction !== 'check' ) {
403+ if ( this . indeterminate && clickAction !== 'check' ) {
414404
415405 Promise . resolve ( ) . then ( ( ) => {
416406 this . _indeterminate = false ;
@@ -426,7 +416,7 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
426416 // It is important to only emit it, if the native input triggered one, because
427417 // we don't want to trigger a change event, when the `checked` variable changes for example.
428418 this . _emitChangeEvent ( ) ;
429- } else if ( ! this . disabled && this . _clickAction === 'noop' ) {
419+ } else if ( ! this . disabled && clickAction === 'noop' ) {
430420 // Reset native input when clicked with noop. The native checkbox becomes checked after
431421 // click, reset it to be align with `checked` value of `mat-checkbox`.
432422 this . _inputElement . nativeElement . checked = this . checked ;
0 commit comments