title: Why is this Angular JS filter removing spaces?
body: <p>I'm making a tiny app to learn Angular, and have made a custom filter for text processing.  Everything is working fine, except that in cases when my output text has multiple spaces, these get automatically reduced to a single space, which I don't want.  The issue is not in the function I've defined, because I'm logging the output, which does not have the problem.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;textarea name="textarea" rows="10" cols="50" ng-model="encodeText" placeholder="Type or paste in a message to encode." &gt;&lt;/textarea&gt;
  &lt;p&gt;Filtered input: {{ encodeText | encode }}&lt;/p&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>(function(){
    var app = angular.module('myApp', []);
    app.filter("encode", function() {
      return function(input) {
        if (input) {
          //text processing
          console.log(output);
          return output;
        }
      };
   });
  </code></pre>
  
  <p>It is a Morse Code exercise.  So console log output is:</p>
  
  <pre><code>.- -... -.-.   -.. . ..-. 
  </code></pre>
  
  <p>With two spaces.  On the page I see:</p>
  
  <pre><code>Filtered input: .- -... -.-. -.. . ..-.
  </code></pre>
  
  <p>The only suggestion I'm seeing from Googling is using ng-trim="false" on the textarea, which has no effect.  It seems the trimming is happening within the filter itself.  What is causing this and how do I disable it?  <a href="https://github.com/brian-davis/angular-morse-code" rel="nofollow">Code repo</a></p>