12345678910111213141516171819202122232425 |
- import { Pipe, PipeTransform } from "@angular/core";
- /**
- * Generated class for the ReplaceHashtagsPipe pipe.
- *
- * See https://angular.io/api/core/Pipe for more info on Angular Pipes.
- */
- @Pipe({
- name: "replaceHashtags"
- })
- export class ReplaceHashtagsPipe implements PipeTransform {
- /**
- * Takes a string and highlights the hashtags.
- */
- transform(value: string, ...args) {
- for (let hashtag of args[0]) {
- value = value.replace(
- "#" + hashtag.text,
- '<span class="hashtag">#' + hashtag.text + "</span>"
- );
- }
- return value;
- }
- }
|