title: getting ".then() is not a function" error when using AngularJS
body: <p>This is my JS:</p>
  
  <pre><code>self.obj = {}
  self.obj.accessErrors = function(data) {
      var cerrorMessages = [];
      for (prop in data) {
          if (data.hasOwnProperty(prop)){
              if (data[prop] != null &amp;&amp; data[prop].constructor ==  Object) {
                  self.obj.fetch[accessErrors](data[prop]);
              }
              else {
                  cerrorMessages.push(data[prop]);
              }
          }
      }
      return cerrorMessages;
  };
  
  self.obj.fetch = {
      X: function() {
          // do stuff.
      },
  
      Y: function(callback) {
          $http.get('/yposts/').then(
              function(response) {
                  self.posts = response.data;
                  callback(self.posts);
              },
              function(response) {
                  self.posts = {};
  
                  self.obj.accessErrors(response.data).then(function(cerrrorMessages) {
                      callback(posts, cerrorMessages);
                  });
              }
          );
      }
  };
  </code></pre>
  
  <p>And I am getting an error pointing to this line:</p>
  
  <pre><code>self.obj.accessErrors(response.data).then(function(cerrrorMessages) {
  </code></pre>
  
  <p>The error says:</p>
  
  <pre><code>TypeError: self.obj.accessErrors(...).then is not a function
  </code></pre>
  
  <p>Any idea how to solve this?</p>