как мне сделать обертку для mat-select, и внутри нее будет другая обертка для mat-option и использовать ее в других компонентах
select. html
<mat-select>
<app-option></app-option>
</mat-select>
select.ts
import {
Component,
OnInit,
Input,
ViewChildren,
QueryList,
} from '@angular/core';
import { CustFormControlDirective } from 'src/app/forms/cust-form-control';
import { MatFormFieldControl } from '@angular/material/form-field';
import { OptionComponent } from '../option/option.component';
@Component({
selector: 'app-select',
templateUrl: './select.component.html',
styleUrls: ['./select.component.scss'],
providers: [{ provide: MatFormFieldControl, useExisting: SelectComponent }],
})
export class SelectComponent extends CustFormControlDirective<string> {}
option. html
<mat-option></mat-option>
option.ts
import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core';
@Component({
selector: 'app-option',
templateUrl: './option.component.html',
styleUrls: ['./option.component.scss'],
})
export class OptionComponent implements OnInit {
constructor() {}
ngOnInit(): void {}
}
app. html
<mat-form-field>
<app-select></app-select>
</mat-form-field>