title: Passing Custom Headers to Ajax request on Select2
body: <p>We are trying to implement Ajax Remote data loading in Select2:-</p>
  
  <pre><code> $scope.configPartSelect2 =  {
          minimumInputLength: 3,
          ajax: {
              url: "/api/Part",
             // beforeSend: function (xhr) { xhr.setRequestHeader('Authorization-Token', http.defaults.headers.common['Authorization-Token']); },
            //  headers: {'Authorization-Token': http.defaults.headers.common['Authorization-Token']},
              data: function (term, page) {
                  return {isStockable: true};
              },
              results: function (data, page) {
                  // parse the results into the format expected by Select2.
                  // since we are using custom formatting functions we do not need to alter remote JSON data
                    return { results: data };
  
              }
          }
      };
  </code></pre>
  
  <p>We are using AngularJS.
  With each Http request we have set it's default to have our Authtoken as header.
  But somehow it is not working in conjunction with Select2 Ajax request. In above code, commented code are my failed attempts.</p>