title: proper way to call http (RESTFUL WebAPI) in angularjs
body: <p>I have following controller code</p>
  
  <pre><code>module.registerController('DemoCtrl', function ($scope, myFactory) {
          myFactory.get(function (data) {
              console.log(data); /// data is always undefined 
          });
      });
  </code></pre>
  
  <p>and following the factory which is calling restful webapi</p>
  
  <pre><code>module.registerFactory('myFactory', ['$http',
      function ($http) {
              function get(callback) {
                  $http.get('mywebapiurl')
                      .success(function (response) {
                          //debugger; data comes back from server
                          callback(response);
                      }).error(function (response, status, headers, config) {
                          callback(response);
                      });
              }
  
          return {
              get: get
          }
      }]);
  </code></pre>
  
  <p>The factory is calling webapi service and does gets the data back. However in controller the data doesnt get returned. </p>
  
  <p>Am I missing something obvious here? Also not sure if this is the best way to call webservice in angularjs in controller using factory. Any inputs are most welcome.</p>
  
  <p>Thanks,</p>