在Ionic Framework中添加完整的联系人详细信息

时间:2015-04-08 05:51:34

标签: ionic-framework ngcordova

在ngCordova的联系人官方文档中,它只显示$scope.contactForm,在其他示例中(下面的链接)仅显示如何添加显示名称。如何添加电话号码电子邮件,地址等字段...

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/

1 个答案:

答案 0 :(得分:3)

$scope.contactForm = {

    "displayName": "jones",
    "name": {
        "givenName": "jones",
        "formatted": "jones "
    },
    "nickname": null,
    "phoneNumbers": [
        {
            "value": "99999999999",
            "type": "mobile"
        }
    ],
    "emails": [
        {
            "value": "xddf@dd.com",
            "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
}