title: AngularUI datepicker set json date
body: <p>Using <a href="https://angular-ui.github.io/bootstrap/#/datepicker" rel="nofollow noreferrer">Angular UI Bootstrap datepicker</a> in a project.</p>
  
  <p>How to setup a angular js with json date as initial date? My server returns JSON date and using the same in angular scope object.</p>
  
  <p>However it shows the same json notation in the textbox instead of the dd/MM/yyyy (20/08/2015) format which i expect</p>
  
  <p><a href="https://i.stack.imgur.com/j90Lx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j90Lx.png" alt="enter image description here"></a></p>
  
  <p>Code is</p>
  
  <pre><code>&lt;input type="text" datepicker-popup="dd/MM/yyyy"  ng-model="model.GrnDate" is-open="openedGRNDatePicker" datepicker-options="dateOptions" close-text="Close"
                                 class="form-control" /&gt;
                          &lt;span class="input-group-btn"&gt;
                              &lt;button type="button" ng-click="openDatePicker($event,'openedGRNDatePicker')" class="btn btn-default"&gt;
                                  &lt;em class="fa fa-calendar"&gt;&lt;/em&gt;
                              &lt;/button&gt;
                          &lt;/span&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>$scope.model=data;//loaded from server
   //data.GrnDate="/Date(1440009000000)/"
  $scope.openDatePicker = function ($event, opened) {
      $event.preventDefault();
      $event.stopPropagation();
  
      $scope[opened] = true;
  };
  $scope.dateOptions = {
      formatYear: 'yy',
      startingDay: 1
  };
  </code></pre>