title: AngularJS : How to call a function within factory?
body: <p>I have two function in factory</p>
  
  <p>here is some code </p>
  
  <pre><code>.factory('getArticles', function ($http, $q) {
     return {
         abc : function() {
          var deferred = $q.defer();
          // my code 
              res= this. bcd();
              console.log(res); // undefined
            deferred.resolve(res);
  
            return deferred.promise;
         },
         bcd: function() {
  
          //some codee 
  
           return res; 
  
         }
     }
  
  });
  </code></pre>
  
  <p>Now from controller i am calling abc  function 
  but when i checked value of res under logs. this is showing undefined.</p>
  
  <p>Any idea ? how to do this ?</p>
  
  <p>Thanks</p>