AngularJS. How to make this promise successful?

I am writing an app to using cordova ionic to retrieve contact list and then display on the iphone screen. I want to print out the controllers' console.log "string" after I execute the listContacts and onSuccess function in Services.coffee, but it seems like that onSuccess function cannot return a deferred.promise, can any help me ?

angular.module 'services.main', []


  .factory "ContactsDB", ->
    db = new PouchDB("contacts")
    db

  .service("ContactsService", [
    "$q"
    "ContactsDB"
    ($q, ContactsDB) ->
      formatContact = (contact) ->
        console.log contact

      listContacts = ->
        console.log "haaaaaa"
        options = new ContactFindOptions()
        options.filter = ''
        options.multiple = true

        fields = ["id", "photos", "name", "phoneNumbers"]
        navigator.contacts.find fields, onSuccess, onError, options
        deferred.promise


      onSuccess = (contacts) ->
        console.log "Hi baby"
        deferred = $q.defer()
        console.log deferred
        console.log deferred.resolve formatContact(contacts)
        deferred.promise

      onError = (error) ->
        console.log error

      return listContacts: listContacts
  ])

and this is my controllers.coffee

angular.module 'controllers.main', ['services.main']

.controller 'NavCtrl', ($scope, $ionicSideMenuDelegate) ->
  $scope.showMenu = ->
    $ionicSideMenuDelegate.toggleLeft()

.controller "CustomersCtrl", [
  "$scope"
  "ContactsService"
  "ContactsDB"
  ($scope, ContactsService, ContactsDB) ->
    $scope.listContacts = ->
      ContactsService.listContacts().then ((contact) ->
        console.log "Hi babbbbbbbbbbbbbbbb"
        return
      ), (failure) ->
        console.log "Bummer.  Failed to pick a contact"
        return

      return
]