title: How to further abstract directives that have too much duplicated logic
body: <p>I'm working on a codebase where multiple directive are using essentially duplicated logic with only an object that is passed through scope changing. For example:</p>
  
  <pre><code>return {
          restrict: 'A',
          scope:{
              someObject:"="
          },
  
  link: function( scope, element, attrs ) {
  
  scope.getSomeObject = function(){
  ...
      return scope.someObject.$$getSomeObject;
  ...
  }
  scope.saveSomeObject = function(){
  ...
      scope.someObject.$$saveSomeObject();
  ...
  }
  scope.removeSomeObject = function(){
  ...
      scope.someObject.$$removeSomeObject();
  ...
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The logic for each function is more complicated but essentially what I've shown. Generally, the functions are almost exactly the same, though here and there, special cases pop up. To me it seems that directives were essentially created to solve the problem of having to write this code every time, and when a bug is found, it has to be fixed everywhere. The directives also duplicate most (but not all) of their logic in their respective templateUrls as well. What is the most sensible way to write this once and use over and over for the various object/cases?</p>