title: Add select all button to mat-select with mat-optgroup
body: <p>I want to add the button "select all" and "deselect all" to a mat-select with groups division. </p>
  
  <p>My code is available here: 
    <a href="https://stackblitz.com/edit/angular5-selectall-with-groups?file=app/select-reset-example.html" rel="nofollow noreferrer">https://stackblitz.com/edit/angular5-selectall-with-groups?file=app/select-reset-example.html</a></p>
  
  <p>This code is based on this working demo for a simple mat-select: 
  <a href="https://stackblitz.com/edit/angular-material-select-multi-c6vtux?file=app%2Fapp.component.ts" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-material-select-multi-c6vtux?file=app%2Fapp.component.ts</a></p>
  
  <p>In my code I need to loop over 4 arrays, so I started tested the "selectAll()" function for the first array. However, only the first checkbox is selected, even if the [ngModel] shows that the function takes all the values inside the array. 
  I also need to make this function works for the other three arrays. </p>
  
  <p>I hope someone can help me fix the problem. 
  I can also change the code if there is a better way of doing what I am trying to achieve. </p>