1 year ago

#380822

test-img

Matt

Wrap a material component (mat-select) inside a component of mine

I'm trying to use mat-select of Angular Material 11.2.12.

Since I need to make mat-select do some stuff (filter, select/deselect all) besides its default behavior, I need to put it inside a component of mine.

Something like this:

<my-component>    
    <mat-select #select [formControlName]="selectControl" multiple>  
     <my-stuff>bla bla bla</my-stuff>
      <mat-option *ngFor="let item of filteredItems" [value]="item.value">{{ item.text }}</mat-option>
    </mat-select>    
</my-component>

What should I do inside <my-component> to be able to use <my-component> inside a form, as I'm now able to use <mat-select> inside a form.

Thanks for your help

angular

angular-material

angular-reactive-forms

angular-forms

angular-template-form

0 Answers

Your Answer

Accepted video resources