title: Angularjs filter error: "Error: Unknown provider: textProvider"
body: <p>I created a custom filter for my angularjs project similar to the following fiddle <a href="http://jsfiddle.net/tUyyx/" rel="noreferrer">http://jsfiddle.net/tUyyx/</a>.</p>
  
  <pre><code>myapp.filter('truncate',function(text,length){
      var end = "..."
      text = text.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
      if (isNaN(length))
       length = 23;
  
  
  
      if (text.length &lt;= length || text.length - end.length &lt;= length) {
          return text;
      }
      else {
          return String(text).substring(0, length-end.length) + end;
      }
  
  });
  </code></pre>
  
  <p>but when I use the filter i get the following error</p>
  
  <pre><code>Error: Unknown provider: textProvider &lt;- text &lt;- truncateFilter
      at Error (&lt;anonymous&gt;)
      at http://localhost/javascripts/lib/angular.min.js:28:236
      at Object.c [as get] (http://localhost/javascripts/lib/angular.min.js:26:13)
      at http://localhost/javascripts/lib/angular.min.js:28:317
      at c (http://localhost/javascripts/lib/angular.min.js:26:13)
      at Object.d [as invoke] (http://localhost/javascripts/lib/angular.min.js:26:147)
      at http://localhost/javascripts/lib/angular.min.js:28:335
      at Object.c [as get] (http://localhost/javascripts/lib/angular.min.js:26:13)
      at http://localhost/javascripts/lib/angular.min.js:99:481
      at o (http://localhost/javascripts/lib/angular.min.js:66:471) 
  </code></pre>
  
  <p>I have created my module like this.</p>
  
  <pre><code>var myapp = angular.module('myapp', ['ngResource']);
  </code></pre>
  
  <p>What am i doing wrong? </p>