import{ Pipe, PipeTransform }from'@angular/core';@Pipe({ name:'nguiHighlight'})exportclassNguiHighlightPipeimplementsPipeTransform{transform(text:string, search:string):string{let ret = text;if(search){const re =newRegExp(search,'ig');
ret = text.replace(re, match =>`<span class="ngui-highlight">${match}</span>`);}return ret;}}