 # ----------------------------------------------------------------------------------------------------------------------
 # 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

  # ------------------------------------------------------------------------------------------------------------------
  # TODO prevent multipal duplicated requests
  vm.refresh_all_notes = ->
    apiClient.notes.all (data) ->
      # TODO handle failure
      vm.all_notes = data['notes']

  vm.load_note = (guid) ->
    # check if the note to be loaded is already current note

      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
