11import  type  { InvalidParams }  from  '@utils/invalid-params.pipe' ; 
22
33import  { AsyncPipe }  from  '@angular/common' ; 
4- import  { ChangeDetectionStrategy ,  Component ,  ComponentRef ,  inject ,  input ,  output }  from  '@angular/core' ; 
4+ import  { 
5+   ChangeDetectionStrategy , 
6+   ChangeDetectorRef , 
7+   Component , 
8+   ComponentRef , 
9+   inject , 
10+   input , 
11+   output , 
12+ }  from  '@angular/core' ; 
513import  { toObservable }  from  '@angular/core/rxjs-interop' ; 
614import  { 
715  AbstractControl , 
@@ -118,7 +126,7 @@ interface Form {
118126    exactly : FormControl < boolean > ; 
119127  } > ; 
120128  spec_id ?: FormControl < specValue > ; 
121-   vehicle_type_id ?: FormControl < null   |   string [ ] > ; 
129+   vehicle_type_id ?: FormControl < string [ ] > ; 
122130} 
123131
124132interface  ItemMetaFormAPISpec  { 
@@ -196,6 +204,7 @@ export class ItemMetaFormComponent {
196204  readonly  #picturesClient =  inject ( PicturesClient ) ; 
197205  readonly  #languageService =  inject ( LanguageService ) ; 
198206  readonly  #modalService =  inject ( NgbModal ) ; 
207+   readonly  #cdr =  inject ( ChangeDetectorRef ) ; 
199208
200209  readonly  invalidParams  =  input . required < InvalidParams > ( ) ; 
201210  readonly  submitted  =  output < ItemMetaFormResult > ( ) ; 
@@ -403,7 +412,7 @@ export class ItemMetaFormComponent {
403412        ) ; 
404413      } 
405414      if  ( [ ItemType . ITEM_TYPE_TWINS ,  ItemType . ITEM_TYPE_VEHICLE ] . includes ( item . itemTypeId ) )  { 
406-         elements . vehicle_type_id  =  new  FormControl ( vehicleTypeIDs ) ; 
415+         elements . vehicle_type_id  =  new  FormControl ( vehicleTypeIDs ,   { nonNullable :  true } ) ; 
407416      } 
408417      if  ( item . itemTypeId  !==  ItemType . ITEM_TYPE_COPYRIGHT )  { 
409418        elements . begin  =  new  FormGroup ( { 
@@ -470,6 +479,7 @@ export class ItemMetaFormComponent {
470479
471480    modalRef . componentInstance . changed . subscribe ( ( value : string [ ] )  =>  { 
472481      vehicleTypeIDs . setValue ( value ) ; 
482+       this . #cdr. markForCheck ( ) ; 
473483    } ) ; 
474484  } 
475485
@@ -496,6 +506,7 @@ export class ItemMetaFormComponent {
496506        i ++ ; 
497507      } ) ; 
498508    } 
509+     this . #cdr. markForCheck ( ) ; 
499510  } 
500511
501512  protected  onPictureClick ( e : PicturesListItem ,  ctrl : FormArray < FormControl < string > > )  { 
@@ -512,5 +523,6 @@ export class ItemMetaFormComponent {
512523        i ++ ; 
513524      } ) ; 
514525    } 
526+     this . #cdr. markForCheck ( ) ; 
515527  } 
516528} 
0 commit comments