(function() {
  angular.module('notely.login')
    .service('CurrentUser', CurrentUser);

  CurrentUser['$inject'] = ['$window']
  function CurrentUser($window) {
    var currentUser = JSON.parse($window.localStorage.getItem('currentUser'));

    this.set = function(user) {
      currentUser = user;
      $window.localStorage.setItem('currentUser', JSON.stringify(currentUser));
    }

    this.get = function() {
      return currentUser || {};
    }

    this.clear = function() {
      currentUser = undefined;
      $window.localStorage.removeItem('currentUser');
    }
  }
})();

angular.module('notely.login')
  .service('CurrentUser', ['$window', ($window) => {

  class CurrentUser {
    constructor() {
      this.currentUser = JSON.parse($window.localStorage.getItem('currentUser'));
    }

    set(user) {
      this.currentUser = user;
      $window.localStorage.setItem('currentUser', JSON.stringify(this.currentUser));
    }

    get() {
      return this.currentUser || {};
    }

    clear() {
      this.currentUser = undefined;
      $window.localStorage.removeItem('currentUser');
    }
  }
  return new CurrentUser();

}]);

Make CurrentUser service use class syntax with inherited dependencies.