(function() {
  angular.module('notely.notes.service', [])
    .service('notes', notesService);

  notesService['$inject'] = ['$http', '$filter', '$state', 'constants'];
  function notesService($http, $filter, $state, constants) {
    var notes = [];
    var user = {
      apiKey: '$2a$10$3UAODMts8D3bK8uqwe2mF.F39vZD3/CypYXLUk1yvhpedfbMiBaFW'
    }

    this.all = function() {
      return notes;
    }

    this.findById = function(noteId) {
      var note = ($filter('filter')(notes, {
        id: parseInt(noteId)
      }, true)[0] || {});

      return angular.copy(note);
    };

    this.fetchNotes = function() {
      return $http.get(constants.apiBasePath + 'notes?api_key=' + user.apiKey)
        .success(function(notesData) {
          notes = notesData;
        });
    };

    this.replaceNote = function(note) {
      for (var i = 0; i < notes.length; i++) {
        if (notes[i].id === note.id) {
          notes.splice(i, 1);
          notes.unshift(note);
          break;
        }
      }
    };

    this.removeNote = function(note) {
      for (var i = 0; i < notes.length; i++) {
        if (notes[i].id === note.id) {
          notes.splice(i, 1);
          break;
        }
      }
    };

    this.create = function(note) {
      $http.post(constants.apiBasePath + 'notes', {
        api_key: user.apiKey,
        note: {
          title: note.title,
          body_html: note.body_html
        }
      })
        .success(function(noteData) {
          notes.unshift(noteData.note);
          $state.go('notes.form', { noteId: noteData.note.id });
        });
    }

    this.update = function(note) {
      var self = this;
      return $http.put(constants.apiBasePath + 'notes/' + note.id, {
        api_key: user.apiKey,
        note: {
          title: note.title,
          body_html: note.body_html
        }
      }).success(function(noteData) {
        self.replaceNote(noteData.note);
      });
    }

    this.delete = function(note) {
      var self = this;
      return $http.delete(constants.apiBasePath + 'notes/' + note.id + '?api_key=' + user.apiKey)
      .success(function(result) {
        self.removeNote(note);
      });
    }
  }
})();

@@ -264,92 +264,10 @@
  = %7B
-%0A      apiKey: '$2a$10$3UAODMts8D3bK8uqwe2mF.F39vZD3/CypYXLUk1yvhpedfbMiBaFW'%0A    
 %7D%0A
+
 %0A   
@@ -418,24 +418,14 @@
 id: 
-parseInt(
 noteId
-)
 %0A   
@@ -581,32 +581,9 @@
 otes
-?api_key=' + user.apiKey
+'
 )%0A  
@@ -1187,38 +1187,8 @@
 , %7B%0A
-        api_key: user.apiKey,%0A
     
@@ -1576,38 +1576,8 @@
 , %7B%0A
-        api_key: user.apiKey,%0A
     
@@ -1809,32 +1809,32 @@
 ar self = this;%0A
+
       return $ht
@@ -1889,36 +1889,8 @@
 e.id
- + '?api_key=' + user.apiKey
 )%0A  

Remove references to api_key/apiKey.