DiPix, the problem is that Angular add the control status CSS classes to your custom control, NOT to the ng-select that belong to your inner control
You can inject the ngControl and check about control.control.invalid and control.control.touched
constructor(private injector:Injector){}
ngOnInit()
{
this.control = this.injector.get(NgControl);
}
then you can use some like
<ng-select #mySelect [ngClass]="{'ng-invalid':control?.control.invalid,
'ng-touched':control?.control.touched}"
....>
Another aproach is ask about the class of the parent. So if you defined a getter like
get parentClass()
{
const match = /class=\"(.*?)\">/.exec(this.element.nativeElement.parentElement.innerHTML);
return match[0].split('"')[1]
}
constructor(private element:ElementRef){}
You can use
<ng-select #mySelect [ngClass]="parentClass"
...>
You can see in your forked stackblitz
NOTE: Anyway, to wrapper a ng-select, is unnecesary create a custom form control, just a simple component with a @Input
@Input()control:any
And you use as
<mycontrol [control]="someForm.get('someControl')"></mycontrol>
You can see how simple becomes in this another stackblitz