title: How to truncate by words not by character in Angular release 6
body: <p>I'm working on a truncate pipe in angular and I've got code that will truncate text by a specified length of 35 words but it's currently truncating to 35 characters....</p>
  
  <p>html : </p>
  
  <pre><code> &lt;p *ngIf="item.description.length &gt; 0"&gt;&lt;span class="body-12-bold"&gt;Description: &lt;/span&gt;&lt;span&gt;{{ description | truncate:[35] }}&lt;/span&gt;&lt;/p&gt;
  </code></pre>
  
  <p>Transform Pipe :</p>
  
  <pre><code>    @Pipe({name: 'truncate'})
      export class TruncatePipe implements PipeTransform {
          constructor(private item: SearchEntry, private config: ConfigService) { }
          transform(value: string, args: string[]): string {
              const limit = args.length &gt; 0 ? parseInt(args[0], 10) : 20;
              const trail = args.length &gt; 1 ? args[1] : '...';
              return value.length &gt; limit ? value.substring(0, limit) + trail : value;
          }
      }
  </code></pre>