title: How do you add a value to datepicker from an Angular Factory?
body: <p>i have an Angular Factory that gets a single date from the backend of my spring application, and i wanted to add it to an Input so the calendar input is always  set with the date obtained from the backend, without the possibility for the user to change it. How could i achieve this? Should i put it on my controller or directly on the button? This is my code: </p>
  
  <p>Factory(concatenated with other .factory):</p>
  
  <pre><code>.factory('DataInizioGeneraCalendario', function ($resource) {
  return $resource('rest/anagrafica/dataInizioGeneraCalendario', {
      get: {
          method: 'GET'
      }
  });
  </code></pre>
  
  <p>Controller Function:</p>
  
  <pre><code> $scope.generaCalendario = function () {
      $scope.modificaCalendarioDiv = true;
      $scope.successMessage = false;
      $("#idModificaCalendarioDiv").hide();
      $scope.element = new Calendario();
      autoScroll('generaCalendario');
      $("#idErrorTemplate").hide();
      $('#data').attr('disabled', false);
      $("#idGeneraCalendarioDiv").show();
  };
  </code></pre>
  
  <p>Input : </p>
  
  <pre><code>&lt;div class="col-xs-12 col-md-2" &gt;
                      &lt;label for="dataInizio" class="row col-xs-12 control-label" style="text-align: left"&gt;da Data&lt;/label&gt;
                      &lt;input class="datepicker form-control" placeholder="gg/mm/aaaa" required type="text" id="data" ng-disabled="true" /&gt;
                  &lt;/div&gt;
  </code></pre>
  
  <p>Edit : forgot to add, the controller function is called by the button that displays the input for the calendar.</p>