5

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?

2
  • 1
    Can you just not set an href at all, and use CSS to style them the same? Commented Aug 14, 2013 at 20:47
  • @OverZealous I read elsewhere that this is possibly a good way to go. Either not include href or just include href with no value. Thanks. Commented Aug 15, 2013 at 2:50

1 Answer 1

9

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>

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.