title: How to add dataType property of ajax in $http of angular?
body: <p>I want to make  a rest call to server using Angular but I am block I tried with traditional jQuery ajax call with Basic Authorization header looks something like this:</p>
  
  <pre><code>        jQuery.ajax({
              url: "http://localhost:8080/public/emp",
              type: "GET",
              dataType:"jsonp",
              Accept : "application/json",
              contentType: "application/json",
              headers: {
                  'Authorization': 'Basic XXXXXXXXXXX'
              },
              success: function (data){
                  alert(data);
              },
              error: function(){
                  alert('Error');
              }
          });
  </code></pre>
  
  <p>It works perfectly and Data is retrieved.</p>
  
  <p>But When I try to convert it with $http of AngularJs. Something like this:</p>
  
  <pre><code>        $http({
              method:'GET',
              url : 'http://localhost:8080/public/emp',
              headers: {'Authorization': 'Basic XXXXXXXXXX',"content-type":"application/json","Accept" : "application/json"}})
          .success(function (data) {
              alert("success");
          })
          .error(function (error) {
              alert("error");
          });
  </code></pre>
  
  <p>Its giving me Error 401 - Unauthorized</p>
  
  <p>How can I add dataType property to $http? I have tried <a href="https://stackoverflow.com/questions/15205037/how-to-specify-datatype-json-in-angular-js-http-post">this</a> link of stack overflow but Still unable to get a solution.</p>