Comments (2)
it appears that this scenario would require dynamically adding span
tags to filter wordsβquite an easy thing to do in jQuery but not really jumping out at me from an Angular point of view
from songhay-ng-workspace.
it appears that the Angular pipe might be the way to go: https://gist.github.com/adamrecsko/0f28f474eca63e0279455476cc11eca7
import {PipeTransform, Pipe} from '@angular/core';
@Pipe({ name: 'highlight' })
export class HighlightPipe implements PipeTransform {
transform(text: string, search): string {
var pattern = search.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
pattern = pattern.split(' ').filter((t) => {
return t.length > 0;
}).join('|');
var regex = new RegExp(pattern, 'gi');
return search ? text.replace(regex, (match) => `<span class="highlight">${match}</span>`) : text;
}
}
from songhay-ng-workspace.
Related Issues (20)
- publish packages on npm (https://www.npmjs.com/) HOT 2
- re-factor yt player lib to use AppDataStore HOT 9
- move `angular.io-index-app` into `songhay-ng-workspace` HOT 24
- make @songhay/index styling configurable HOT 12
- relative path issues: will passing around location.path() help? HOT 1
- make @songhay/player-video-you-tube styling configurable HOT 6
- migrate filter-form CSS from `Songhay.Blog`
- generate @songhay/player-audio-progressive lib and migrate assets
- does @songhay/player-audio-progressive lib still need audio5js or equivalent? HOT 1
- try TsUML for @songhay/core at least π
- @songhay/core needs to be published HOT 1
- add sample based on angular - How can I call a service within a pipe?β
- upgrade to Angular 9 HOT 11
- `ng build --prod`: `compilation of entry points` error
- `ng update` does not really touch karma-jasmine and typescript packages HOT 1
- remove `you-tube-presentation` component
- consider removing any logic/concerns for showing `you-tube-thumbs` individually
- upgrade dependencies π¦β HOT 15
- consider cancelling the @songhay/player-audio-progressive project
- add caching (with `Window.localStorage`?) to `player-video-you-tube`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from songhay-ng-workspace.