title: call prototype method inside callback function of prototype method
body: <p>i have javascript class and 2 prototype methods </p>
  
  <pre><code>var proEdit = function(){
      this.client;
      var self = this;
  }
  /*
      class method to load all the project releted details 
  */
  proEdit.prototype.loadProject = function(){
      this.client =  $serviceCall.setClient("getAllByProjectID","project"); // method name and service
      this.client.ifSuccess(function(data){  //sucess        
          self.kk();
      })
      this.client.ifError(function(data){ //falce
          console.log("error loading setting data")
      })
      this.client.projectID($stateParams.projectID); // send projectID as url parameters
      this.client.getReq(); // get request if post then use 'postReq('jsonbody')'
      return this;
  }
  
  
  proEdit.prototype.kk = function(){
      console.log("sass");
  }
  </code></pre>
  
  <p>inside <code>loadProject</code> method, i'm calling an api using callback function to access data and if it is <code>ifSuccess</code> then i want call the <code>kk</code> prototype method. but it gives me this error.</p>
  
  <p><code>angular.js:12722 TypeError: self.kk is not a function</code></p>
  
  <p>i try to create new instance to the same class and then call the <code>kk</code> function. then it is working  </p>
  
  <pre><code>  this.client.ifSuccess(function(data){  //sucess  
        var in = new proEdit();   
        in.kk();
    })
  </code></pre>
  
  <p>is it happening because of the callback? how can i prevent this. Thank you</p>