https://github.com/huafu/cordova-contact-adapter
An adapter and model for use with cordova contacts plugin
https://github.com/huafu/cordova-contact-adapter
Last synced: 3 months ago
JSON representation
An adapter and model for use with cordova contacts plugin
- Host: GitHub
- URL: https://github.com/huafu/cordova-contact-adapter
- Owner: huafu
- License: mit
- Created: 2015-01-17T08:36:26.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-04T22:35:17.000Z (over 9 years ago)
- Last Synced: 2025-02-18T17:03:08.527Z (4 months ago)
- Language: JavaScript
- Homepage: http://huafu.github.io/#/ember?name=cordova-contact-adapter
- Size: 156 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# cordova-contact-adapter
An adapter and model for use with cordova contacts plugin
## Installation
* `npm install --save-dev cordova-contact-adapter`
* or with the latest `ember-cli`: `ember install:addon cordova-contact-adapter`## Using
* Simply use the `cordova-contact` model as you'd simply do with any other `ember-data` model:
```js
// file: app/routes/contacts.js
import Ember from 'ember';export default Ember.Route.extend({
model: function () {
return this.store.find('cordova-contact');
}
});
```* When querying for specific contacts on multiple fields, be sure to use the same filter value for all the query parameters:
```js
this.store.find('cordova-contact', {name: 'huafu', nickname: 'huafu', displayName: 'huafu'});
```Available fields for searching are the same as `cordova.contacts.fieldType`:
- `addresses`
- `birthday`
- `categories`
- `country`
- `department`
- `displayName`
- `emails`
- `familyName`
- `formatted`
- `givenName`
- `honorificPrefix`
- `honorificSuffix`
- `id`
- `ims`
- `locality`
- `middleName`
- `name`
- `nickname`
- `note`
- `organizations`
- `phoneNumbers`
- `photos`
- `postalCode`
- `region`
- `streetAddress`
- `title`
- `urls`* There are 2 special properties on each model as well as the core ones from cordova contacts plugin:
- `anyName`: to access to the first available name of the contact between all fields from cordova
- `anyPhotoUrl`: to access the first available photo as an URL (normally `file://`)
- `anyPhoneNumber`: to access the first available phone number
- `anyURL`: to access the first available URL
- `anyEmail`: to access the first available email address## Running Tests
* `ember test`
* `ember test --server`---
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).