I'd like a ← Back to home link to appear below the nagivation on every page of my Angular app except the home page. So I'd like to conditionally add the link and hide it using ng-hide
if the url is already on the home page (view) of the app.
I've tried using angular's $location
service with no success
<p ng-hide="location.hash == '#/'" class="container"><a href="#topics">← Back to Home</a></p>
I've tried the following variations:
ng-hide="location.hash == '#/' " //console.log shows true
ng-hide="location.hash === '#/' " //console.log shows true
ng-hide="location.hash == '' " //console.log shows false
I'm puzzled because if I log the value of location.hash == '#/'
when on the home page i get true
, so ng-hide
should work.
Basically I'm trying the 3rd approach listed here: How do I use angular ng-hide based on the page/route that I am currently on? But it's not working. The other two approaches on that page seem overly complicated for what I'm trying to achieve.
What am I missing?