1

I've been struggling with this for a week now. I use Anguarjs and I set the html5mode(true) to get rid of the hash sign "#" that you needed in the url before. Everything works fine amd my URL logic works with Query Parameters.

www.domain.com/thecurrentpage/?title=banana

And it changes and refresh the page when I click on something else and then it displays the right content.

I just want to be able to have a link like:

www.domain.com/thecurrentpage/banana

And come to the same page. That actually will point you to the first one with query params. I feels like I've tried everything in the .htaccess file with rewrite rules and everything with angular routing. I just don't get it.

Lucas
  • 9,871
  • 5
  • 42
  • 52
Tsere
  • 41
  • 3

1 Answers1

0

you want to use the : syntax in your routing.

In your routing add a route like this:

/thecurrentpage/:title

Then you can use:

$routeParams.title

To get the value "banana"

This might help ... AngularJS: Read route param from within controller

danday74
  • 52,471
  • 49
  • 232
  • 283
  • I'm not sure if I understand. When I paste www.domain.com/thecurrentpage/banana into the address field and press ENTER. Then I actually want to come to www.domain.com/thecurrentpage/index.html?title=banana But now I come to www.domain.com/thecurrentpage/banana/index.html...which doesn't exist. – Tsere Oct 28 '17 at 17:35
  • Ok, seems like my biggest problem with this was that I removed the Angular hashtag with html5Mode(true). Things started to make sense when I got it back since then, everything after the hashtag doesn't really count as index.html as I understand it. It is what you specify it to do. I have to remove the hashtag in the .htaccess file instead I suppose. – Tsere Oct 29 '17 at 17:27