I have a CMS which forces URLs to pages to be of a certain pattern. We need to conditionally rewrite these link's hrefs.
The CMS will print on the page something like:
<a href="/path/to/the/zoo/gorilla.html">Go</a>
Our router needs to actually point to
#/zoo/gorilla
If we had written this link ourselves, it would look like:
<a ui-sref="zoo('gorilla')>Go</a>
The problem is, we can't always guarantee that the /zoo/gorilla part means we're at zoo('gorilla').
The easiest way would be to parse the CMS url in to the router URL and just do something like:
link.attr("href", "#/zoo/gorilla");
I understand why that is typically against the very idea of ui-router, but I'm hoping to find a way to use it for this one strange case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With