@@ -26,6 +26,7 @@ import {
2626 numberAttribute ,
2727 inject ,
2828 HostAttributeToken ,
29+ signal ,
2930} from '@angular/core' ;
3031import {
3132 AbstractControl ,
@@ -261,7 +262,7 @@ export class MatCheckbox
261262 }
262263
263264 ngAfterViewInit ( ) {
264- this . _syncIndeterminate ( this . _indeterminate ) ;
265+ this . _syncIndeterminate ( this . indeterminate ) ;
265266 }
266267
267268 /** Whether the checkbox is checked. */
@@ -298,26 +299,26 @@ export class MatCheckbox
298299 */
299300 @Input ( { transform : booleanAttribute } )
300301 get indeterminate ( ) : boolean {
301- return this . _indeterminate ;
302+ return this . _indeterminate ( ) ;
302303 }
303304 set indeterminate ( value : boolean ) {
304- const changed = value != this . _indeterminate ;
305- this . _indeterminate = value ;
305+ const changed = value != this . _indeterminate ( ) ;
306+ this . _indeterminate . set ( value ) ;
306307
307308 if ( changed ) {
308- if ( this . _indeterminate ) {
309+ if ( value ) {
309310 this . _transitionCheckState ( TransitionCheckState . Indeterminate ) ;
310311 } else {
311312 this . _transitionCheckState (
312313 this . checked ? TransitionCheckState . Checked : TransitionCheckState . Unchecked ,
313314 ) ;
314315 }
315- this . indeterminateChange . emit ( this . _indeterminate ) ;
316+ this . indeterminateChange . emit ( value ) ;
316317 }
317318
318- this . _syncIndeterminate ( this . _indeterminate ) ;
319+ this . _syncIndeterminate ( value ) ;
319320 }
320- private _indeterminate : boolean = false ;
321+ private _indeterminate = signal ( false ) ;
321322
322323 _isRippleDisabled ( ) {
323324 return this . disableRipple || this . disabled ;
@@ -419,8 +420,8 @@ export class MatCheckbox
419420 // When user manually click on the checkbox, `indeterminate` is set to false.
420421 if ( this . indeterminate && clickAction !== 'check' ) {
421422 Promise . resolve ( ) . then ( ( ) => {
422- this . _indeterminate = false ;
423- this . indeterminateChange . emit ( this . _indeterminate ) ;
423+ this . _indeterminate . set ( false ) ;
424+ this . indeterminateChange . emit ( false ) ;
424425 } ) ;
425426 }
426427
0 commit comments