7
7
*/
8
8
9
9
import {
10
- AfterViewInit ,
11
10
Attribute ,
12
11
ChangeDetectionStrategy ,
13
12
ChangeDetectorRef ,
@@ -18,12 +17,10 @@ import {
18
17
forwardRef ,
19
18
Inject ,
20
19
InjectionToken ,
21
- OnDestroy ,
22
20
Optional ,
23
21
QueryList ,
24
22
ViewEncapsulation ,
25
23
} from '@angular/core' ;
26
- import { MDCRadioAdapter , MDCRadioFoundation } from '@material/radio' ;
27
24
import {
28
25
MAT_RADIO_DEFAULT_OPTIONS ,
29
26
_MatRadioButtonBase ,
@@ -107,21 +104,7 @@ export class MatRadioGroup extends _MatRadioGroupBase<MatRadioButton> {
107
104
encapsulation : ViewEncapsulation . None ,
108
105
changeDetection : ChangeDetectionStrategy . OnPush ,
109
106
} )
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 {
125
108
constructor (
126
109
@Optional ( ) @Inject ( MAT_RADIO_GROUP ) radioGroup : MatRadioGroup ,
127
110
elementRef : ElementRef ,
@@ -145,28 +128,4 @@ export class MatRadioButton extends _MatRadioButtonBase implements AfterViewInit
145
128
tabIndex ,
146
129
) ;
147
130
}
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
- }
172
131
}
0 commit comments