code: function callApi() {
              vm.pageInfiniteScroll++;
              vm.loadingInfiniteScroll = true;
  
              return $http
                  .get(
                      'https://randomuser.me/api/?results=10&seed=lumapps&page=' + vm.pageInfiniteScroll
                  )
                  .then(function(response) {
                      if (response.data && response.data.results) {
                          return response.data.results.map(function(person) {
                              return {
                                  name: person.name.first,
                                  email: person.email,
                                  age: person.dob.age
                              };
                          });
                      } else {
                          return [];
                      }
                  })
                  .catch(function() {
                      return [];
                  })
                  .finally(function() {
                      vm.loadingInfiniteScroll = false;
                  });
          }
docs: Call sample API.
  
  @return {Promise} Promise containing an array of users.