I\'ve used both href
and ng-href
and I couldn\'t see the difference between them.
Why does Angular have the ng-href
attribute, and
From the documentation:
Using Angular markup like
{{hash}}
in an href attribute will make the link go to the wrong URL if the user clicks it before Angular has a chance to replace the{{hash}}
markup with its value. Until Angular replaces the markup the link will be broken and will most likely return a 404 error. ThengHref
directive solves this problem.
Effectively, the only place you're using it is for links in which you need to rely on a value provided to the DOM by Angular. If you do not require Angular for a part of that link, or you don't plan on using Angular to generate that link, then you do not need to use ngHref
.