 # ----------------------------------------------------------------------------------------------------------------------
 # Service: noteManager
 # ----------------------------------------------------------------------------------------------------------------------
-markever.factory 'noteManager', ['apiClient', (apiClient) -> new class NoteManager
+markever.factory 'noteManager', ['apiClient', 'imageManager', (apiClient, imageManager) -> new class NoteManager
 
   # Status of a note:
   # 1. new: note with a generated guid, not attached to remote


  # ------------------------------------------------------------
  # Load remote note list to update local notes info
  # ------------------------------------------------------------
  load_remote_notes: (on_success, on_error) =>
    # fetch remote notes
    apiClient.notes.all (data)
      # TODO handle failure
      .$promise.then (data) =>
        @_merge_remote_notes(data['notes'])

  # ------------------------------------------------------------
  # merge remote note list into local note list

      guid = note_meta['guid']
      title = note_meta['title']
      @find_note_by_guid(guid).then (local_note) =>
        # TODO check is note not found, what will var note be
        if local_note.length == 0
          @update_note({
            guid: guid
            title: title
