Skip to content

Category: Questions

Getting all elements on a page and hiding them upon filter

I have something that filters groups of cards on a page that works well, until I try to add section headers to each group. Ideally, I’d like all the section headers to disappear when my “no results” block is displayed. I know that the [0] after the line that gets the class name for the secti…

How to keep shareReplay alive when there are no subscribers?

I need to share a hot Observable between multiple subscribers and emit the latest value to new subscribers. I am trying to achieve this with shareReplay(1), however, the first subscriber fails to retrieve the latest value because the shareReplay operator doesn’t do anything when there is no subscription…

Javascript get the value of an href after a certain pattern

I have a url like https://www.whatever.com/en-CA/something I want to capture anything that comes after the en-CA/ (the en-CA can be any combination of characters that have two letters, a dash, and two letters. I am trying to use a regex to grab the window.location.href split the href at the pattern that match…

How to deal with NestJS @Get() decorator?

This block of code works properly. I’m able to access both functions with the URL http://localhost:3000/vehicle/availableVehicles & http://localhost:3000/vehicle/1 accordingly But when I just swap between the 2 functions like code block below then the function availableVehicles() doesn’t work …