Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty anchor tag value using hash or javascript in Angular

Tags:

angularjs

We're trying to come up to speed with Angular.js and our lead JS dev has requested that when we mock up links that don't yet have a page to go to, we should do the following:

<a href="javascript://">

instead of this:

<a href="#">

His reasoning was that Angular already has a use for the hash tag because it means something to Angular and if it doesn't find the router/directive then it is redirected to /scenario.

What is a better way to do this?

like image 931
micah Avatar asked Aug 14 '13 20:08

micah


1 Answers

According to the AngularJS docs for the A directive, you should be using href="".

The reasoning for this is to allow easy creation of action links with ngClick directive without changing the location or causing page reloads, e.g.: <a href="" ng-click="model.$save()">Save</a>

like image 86
Jon7 Avatar answered Nov 11 '22 19:11

Jon7