title: How to get selected value of Material DatePicker from component.ts
body: <p>I have a datepicker in a form of my html file. After submitting the form I need to get the selected value of the datepicker in my component.ts file</p>
  <p>in the html file:</p>
  <pre><code>&lt;form (ngSubmit)=&quot;onSubmit(f)&quot; #f=&quot;ngForm&quot;&gt;
  &lt;input type=&quot;text&quot; class=&quot;datepicker&quot; ngModel id =&quot;from&quot; name=&quot;from&quot; placeholder=&quot;From :&quot;&gt; 
  &lt;/form&gt;
  
  in the component.ts file:
  console.log(f.value.from); 
  </code></pre>
  <p>I have tried the above code and the value I get is undefined.</p>