17 lines
		
	
	
		
			463 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			17 lines
		
	
	
		
			463 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
|  | /** | ||
|  |  * @license | ||
|  |  * Copyright Google LLC All Rights Reserved. | ||
|  |  * | ||
|  |  * Use of this source code is governed by an MIT-style license that can be | ||
|  |  * found in the LICENSE file at https://angular.io/license
 | ||
|  |  */ | ||
|  | 
 | ||
|  | import {Pipe, PipeTransform} from '@angular/core'; | ||
|  | 
 | ||
|  | @Pipe({name: 'truncate'}) | ||
|  | export class TruncatePipe implements PipeTransform { | ||
|  |   transform(value: any, length: number, symbol: string) { | ||
|  |     return value.split(' ').slice(0, length).join(' ') + symbol; | ||
|  |   } | ||
|  | } |