title: Javascript passing "this" from prototype to another function
body: <p>I am struggling with the passing of context "this" from a prototype function in a controller to a private function(s) in the same controller.Browser console throws an error "Cannot read property 'callSomeService' of undefined". My code looks like- </p>
  
  <pre><code>MyController.prototype.somemethod = function (){
        return somePrivateFunction()
                .then(function (resultsFromsomePrivateFunction){
                    return someAnotherPrivateFunction(resultsFromsomePrivateFunction)
         });
  }
  
  function somePrivateFunction(){
     this.callSomeService()
           .then(function (results) {
               return results 
             });
  }
  
  function someAnotherPrivateFunction(){
     //dosomething
  }
  </code></pre>
  
  <p>Can someone please help ?</p>