title: How to create multiple custom filters within a single module in Angularjs
body: <p>I'm following <a href="http://danielcsgomes.com/tutorials/how-to-create-a-custom-filter-with-angularjs-v1/#.UkpHRtJmwaA">this tutorial</a> and created the underneath custom filters accordingly. The last one however causes the first one to disappear; when you use the <code>truncate</code> filter it an exception. How do you create multiple filters within a module?</p>
  
  <pre><code>angular.module('filters', []).filter('truncate', function () {
      return function (text, length, end) {
          if (isNaN(length))
              length = 10;
  
          if (end === undefined)
              end = "...";
  
          if (text.length &lt;= length || text.length - end.length &lt;= length) {
              return text;
          }
          else {
              return String(text).substring(0, length-end.length) + end;
          }
  
      };
  });
  
  
  angular.module('filters', []).filter('escape', function () {
      return function(text) {
        encodeURIComponent(text);  
      };
  });
  </code></pre>