@@ -66,6 +66,12 @@ export class NzRadioGroupComponent implements OnInit, AfterContentInit, ControlV
6666 radio . nzChecked = radio . nzValue === this . _value ;
6767 }
6868
69+ checkRadios ( ) : void {
70+ this . radios . forEach ( ( item ) => {
71+ item . nzChecked = item . nzValue === this . _value ;
72+ } ) ;
73+ }
74+
6975 selectRadio ( radio : NzRadioComponent | NzRadioButtonComponent ) : void {
7076 this . updateValue ( radio . nzValue ) ;
7177 }
@@ -76,19 +82,14 @@ export class NzRadioGroupComponent implements OnInit, AfterContentInit, ControlV
7682 }
7783 this . _value = value ;
7884 this . onChange ( value ) ;
79- this . radios . forEach ( ( item ) => {
80- item . nzChecked = item . nzValue === this . _value ;
81- } ) ;
85+ this . checkRadios ( ) ;
8286 }
8387
8488 constructor ( private _elementRef : ElementRef , private _render : Renderer2 ) {
8589 this . _el = this . _elementRef . nativeElement ;
8690 }
8791
8892 ngAfterContentInit ( ) : void {
89- this . radios . forEach ( ( item ) => {
90- item . nzChecked = item . nzValue === this . _value ;
91- } ) ;
9293 /** trim text node between radio button */
9394 Array . from ( this . _el . childNodes ) . forEach ( node => {
9495 if ( node . nodeType === 3 ) {
@@ -98,7 +99,8 @@ export class NzRadioGroupComponent implements OnInit, AfterContentInit, ControlV
9899 }
99100
100101 writeValue ( value : string ) : void {
101- this . updateValue ( value ) ;
102+ this . _value = value ;
103+ this . checkRadios ( ) ;
102104 }
103105
104106 registerOnChange ( fn : ( _ : string ) => void ) : void {
0 commit comments