Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Modify URL on copy (-paste)

I need to modify the url on copy from an angular project.

When the user selects URL and copy (like ctrl+c), it is

page/item/123

I need to modify that to

page/item?id=123

How can I do that?

Reason: I could not make the web.config work to pass the full path (item/123), so angular cannot parse what is not there.

However, I can make item?id=.... work, so it opens "item" and there I can get the query parameter.

Added: in the comments it was suggested to do it one way/the right way only and I agree - but I am here because my original problem cannot be solved: web.config - forward full path with parameter

How to make rules work with parameters and pass the full path for parsing

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here's how it can be done:

html

<div (copy)="handleCopy($event)">page/item/1234</div>

ts

handleCopy(event: ClipboardEvent) {
  event.clipboardData.setData('text/plain', 
  document.getSelection().toString().replace(/\/(?=[^\/]*$)/, "?id="));
  event.preventDefault();
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!