77 */
88
99import {
10- AfterViewInit ,
1110 Attribute ,
1211 ChangeDetectionStrategy ,
1312 ChangeDetectorRef ,
@@ -18,12 +17,10 @@ import {
1817 forwardRef ,
1918 Inject ,
2019 InjectionToken ,
21- OnDestroy ,
2220 Optional ,
2321 QueryList ,
2422 ViewEncapsulation ,
2523} from '@angular/core' ;
26- import { MDCRadioAdapter , MDCRadioFoundation } from '@material/radio' ;
2724import {
2825 MAT_RADIO_DEFAULT_OPTIONS ,
2926 _MatRadioButtonBase ,
@@ -107,21 +104,7 @@ export class MatRadioGroup extends _MatRadioGroupBase<MatRadioButton> {
107104 encapsulation : ViewEncapsulation . None ,
108105 changeDetection : ChangeDetectionStrategy . OnPush ,
109106} )
110- export class MatRadioButton extends _MatRadioButtonBase implements AfterViewInit , OnDestroy {
111- private _radioAdapter : MDCRadioAdapter = {
112- addClass : ( className : string ) => this . _setClass ( className , true ) ,
113- removeClass : ( className : string ) => this . _setClass ( className , false ) ,
114- setNativeControlDisabled : ( disabled : boolean ) => {
115- if ( this . disabled !== disabled ) {
116- this . disabled = disabled ;
117- this . _changeDetector . markForCheck ( ) ;
118- }
119- } ,
120- } ;
121-
122- _radioFoundation = new MDCRadioFoundation ( this . _radioAdapter ) ;
123- _classes : { [ key : string ] : boolean } = { } ;
124-
107+ export class MatRadioButton extends _MatRadioButtonBase {
125108 constructor (
126109 @Optional ( ) @Inject ( MAT_RADIO_GROUP ) radioGroup : MatRadioGroup ,
127110 elementRef : ElementRef ,
@@ -145,28 +128,4 @@ export class MatRadioButton extends _MatRadioButtonBase implements AfterViewInit
145128 tabIndex ,
146129 ) ;
147130 }
148-
149- override ngAfterViewInit ( ) {
150- super . ngAfterViewInit ( ) ;
151- this . _radioFoundation . init ( ) ;
152- }
153-
154- override ngOnDestroy ( ) {
155- super . ngOnDestroy ( ) ;
156- this . _radioFoundation . destroy ( ) ;
157- }
158-
159- private _setClass ( cssClass : string , active : boolean ) {
160- this . _classes = { ...this . _classes , [ cssClass ] : active } ;
161- this . _changeDetector . markForCheck ( ) ;
162- }
163-
164- /**
165- * Overrides the parent function so that the foundation can be set with the current
166- * disabled state.
167- */
168- protected override _setDisabled ( value : boolean ) {
169- super . _setDisabled ( value ) ;
170- this . _radioFoundation . setDisabled ( this . disabled ) ;
171- }
172131}
0 commit comments