title: Using ngValue with Angular Material autocomplete?
body: <p>I am passing in an object as my value and need to use [ngValue] as opposed to [value].</p>
  
  <p>My HTML looks like this:</p>
  
  <pre><code>&lt;mat-input-container fxFlex="18" fxFlexOffset="1"&gt;
      &lt;input
          matInput
          placeholder="Example"
          [matAutocomplete]="autocomplete"
          [ngModel]="user?.UserName"
          (ngModelChange)="filter($event)"
          [disabled]="disabled"/&gt;
       &lt;mat-autocomplete #autocomplete="matAutocomplete" 
                         (optionSelected)="optionSelected($event)" &gt;
           &lt;mat-option *ngFor="let selectedUser of availableUsers" [ngValue]="selectedUser"&gt;
               &lt;span&gt;{{ selectedUser?.UserName }}&lt;/span&gt;
           &lt;/mat-option&gt;
       &lt;/mat-autocomplete&gt;
  &lt;/mat-input-container&gt;
  </code></pre>
  
  <p>As a demo, I also have a stackblitz with my error provided here:
  <a href="https://stackblitz.com/edit/angular-5wk4rl?file=app%2Fautocomplete-simple-example.html" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-5wk4rl?file=app%2Fautocomplete-simple-example.html</a></p>
  
  <p>I am getting the error:</p>
  
  <p>Template parse errors:</p>
  
  <pre><code>Can't bind to 'ngValue' since it isn't a known property of 'mat-option'.
  
  1. If 'mat-option' is an Angular component and it has 'ngValue' input, then verify that 
     it is part of this module.
  2. If 'mat-option' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the 
     '@NgModule.schemas' of this component to suppress this message.
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the 
     '@NgModule.schemas' of this component.
  </code></pre>
  
  <p>As mentioned in other answer on stack, <a href="https://stackoverflow.com/questions/48782240/angular-cant-bind-to-ngvalue-since-it-isnt-a-known-property-of-mat-option">Angular - Can&#39;t bind to &#39;ngValue&#39; since it isn&#39;t a known property of &#39;mat-option&#39;</a></p>
  
  <p>Users are suggesting that adding it to the modules file will solve the issue but when I tried that (as seen in my material-module.ts in my stackblitz), the error persists.</p>
  
  <p>Any suggestions? I would appreciate any help!</p>