title: Why is .then not a function?
body: <p><strong>service.js</strong></p>
  <pre><code>.factory('EventService', function ($http, $cordovaSQLite) {
      return {
          //some code here..
          populateData: function (data) {
              var items = [];
              for (i = 0; i &lt; data.length; i++) {
                  items.push(data[i]);
              }
              return items;
          }
      }
  })
  </code></pre>
  <p><strong>controller.js</strong></p>
  <pre><code>.controller('NearCtrl', function ($scope, $http, $cordovaSQLite, EventService) {
      EventService.getDataFromDB().then(function (result) {
          if (result.length &gt; 0) {
              EventService.populateData(result).then(function (items) {
                  $scope.items = items;
              })
          } else {
              EventService.getDataFromApi().then(function () {
                  EventService.getDataFromDB().then(function (result) {
                      EventService.populateData(result).then(function (items) {
                          $scope.items = items;
                      })
                  })
              })
          }
      });
  })
  </code></pre>
  <p>When I'm trying to run this code, I get &quot;TypeError: EventService.populateData(...).then is not a function&quot;.</p>
  <p>What am I doing wrong?</p>