Farhan C K
Farhan C K

Reputation: 1158

Adding Full Contact details in Ionic Framework

In the official documentation of contacts in ngCordova, it only says $scope.contactForm, in other example (link below) only show how to add display name. how can I add fields like phone number email, address etc...

module.controller('MyCtrl', function($scope, $cordovaContacts) {
  $scope.addContact = function() {
    $cordovaContacts.save($scope.contactForm).then(function(result) {
      // Contact saved
    }, function(err) {
      // Contact error
    });
  };

  // Many more features will be added shortly
});

https://blog.nraboy.com/2014/11/create-delete-search-contacts-ionic-framework/ http://ngcordova.com/docs/plugins/contacts/

Upvotes: 1

Views: 987

Answers (1)

Farhan C K
Farhan C K

Reputation: 1158

$scope.contactForm = {

    "displayName": "jones",
    "name": {
        "givenName": "jones",
        "formatted": "jones "
    },
    "nickname": null,
    "phoneNumbers": [
        {
            "value": "99999999999",
            "type": "mobile"
        }
    ],
    "emails": [
        {
            "value": "[email protected]",
            "type": "home"
        }
    ],
    "addresses": [
        {
            "type": "home",
            "formatted": "This Address, An Address",
            "streetAddress": "This Address, An Address"
        }
    ],
    "ims": null,
    "organizations": null,
    "birthday": null,
    "note": "",
    "photos": null,
    "categories": null,
    "urls": null
}

Upvotes: 3

Related Questions