title: How to change the date format in the datepicker of Angular ngx-bootstrap inside a form
body: <p>Using ngx-bootstrap Datepicker in an Angular 4 application,</p>
  
  <p>I know that normally you can specify the date format this way:</p>
  
  <pre><code>&lt;input id="from" name="from"
         bsDatepicker [(bsValue)]="myModel"
         value="{{ myModel | date:'yyyy-MM-dd'}}"&gt;
  </code></pre>
  
  <p>but this time I'm inside a template-driven Angular form, so my input is not bound to a variable like <code>myModel</code> in the example above, but it's just bound to the form:</p>
  
  <pre><code>&lt;input id="from" name="from"
         bsDatepicker ngModel&gt;
  </code></pre>
  
  <p>so how can I specify the date format in this case?</p>
  
  <p><strong>Edit</strong>: it looks like that a way to achieve this is by creating a new variable <code>newVar</code> inside the component and then binding it with <code>[(bsValue)]="newVar"</code>:</p>
  
  <pre><code>&lt;input id="from" name="from"
         bsDatepicker ngModel
         [(bsValue)]="newVar"
         value="{{ newVar | date:'yyyy-MM-dd' }}"&gt;
  </code></pre>
  
  <p>However I wonder if there is a better solution.</p>