# Bug in code sample for Get All Contacts?

**URL:** <https://forum.ionicframework.com/t/bug-in-code-sample-for-get-all-contacts/87741>\
**Category:** cordova\
**Created:** [April 25, 2017, 7:01am UTC](https://forum.ionicframework.com/t/bug-in-code-sample-for-get-all-contacts/87741 "2017-04-25T07:01:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wetfeet](https://avatars.discourse-cdn.com/v4/letter/w/cab0a1/32.png) [@wetfeet](https://forum.ionicframework.com/u/wetfeet)\
**Post date:** [April 25, 2017, 7:01am UTC](https://forum.ionicframework.com/t/bug-in-code-sample-for-get-all-contacts/87741/1 "2017-04-25T07:01:37Z")

</div>

For the ngCordova Contacts plugin, the sample code to read/get all contacts without filtering is given as below:

```auto
$scope.getAllContacts = function() {
    $cordovaContacts.find().then(function(allContacts) { //omitting parameter to .find() causes all contacts to be returned
      $scope.contacts = allContacts;
    }
  };

```

Note the `find()` method without any parameter. The comment beside it states, “//omitting parameter to .find() causes **all contacts to be returned** ”

Apparently, the missing options argument seems to cause error for the Cordova plugin.

Thus I suspect we may still need this:

```auto
var opts = { //search options
  filter : "", // Set to empty string to match any contact?
  multiple: true // A search may return multiple contacts
}

// Still need the opts argument after all.
$cordovaContacts.find(opts).then(function(allContacts) {
  $scope.contacts = allContacts;
}};

```

I believe there could be something wrong with the sample code, though I am not 100% sure. If someone can confirm this, it would be great.

Hope this helps someone facing weird error with it.
