title: Angularjs. How can I pass variable as argument to custom filter?
body: <p>I have following HTML</p>
  
  <pre><code>&lt;span class="items-count"&gt;{{items | countmessage}}&lt;/span&gt;
  </code></pre>
  
  <p>And following filter to show right count message</p>
  
  <pre><code>    app.filters
      .filter('countmessage', function () {
          return function (input) {
              var result = input.length + ' item';
              if (input.length != 1) result += 's';
              return message;
          }
      });
  </code></pre>
  
  <p>but I want use different words instead 'item(s)', so I modified the filter</p>
  
  <pre><code>    app.filters
      .filter('countmessage', function () {
          return function (input, itemType) {
              var result = input.length + ' ' + itemType;
              if (input.length != 1) result += 's';
              return message;
          }
       });
  </code></pre>
  
  <p>it works when I use a string like that</p>
  
  <pre><code>&lt;span class="items-count"&gt;{{items | countmessage:'car'}}&lt;/span&gt;
  </code></pre>
  
  <p>but doesn't work with a variable from the $scope, is it possible to use $scope variable</p>
  
  <pre><code>&lt;span class="items-count"&gt;{{items | countmessage:itemtype}}&lt;/span&gt;
  </code></pre>
  
  <p>Thanks</p>