Skip to content
Advertisement

Tag: url-routing

Safely retrieving a value from a route

In my Angular application I have updated some URLs in my project from previously using query string elements like this: http://www.whatever.com/products?productName=TheMainProduct&id=234234 to a route based system similar to this: http://www.whatever.com/products/TheMainProduct/234234 This works fine but most of the time except when there’s a product called something like The / Next / Big Thing So the slashes break the routing as is

Appending form input value to action url as path

I have a form like this: If I type a value, let’s say: ‘hello’ in the text input field and submit the form, the URL looks like: http://localhost/test/?keywords=hello. I want the value to get appended to the action path. So basically, after the form submission the URL should look like: Answer You can use onsubmit attribute and set the action

RegEx to match stuff between parentheses

I’m having a tough time getting this to work. I have a string like: And I need regex or a method of getting each match between the parentheses and return an array of matches like: The regex I’m using is /((.+))/ which does seem to match the right thing if there is only one set of parenthesis. How can I

Advertisement