Questions tagged [angularjs-ng-href]

Part of AngularJS. 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. The ngHref directive solves this problem.

The wrong way to write it:

<a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>

The correct way to write it:

<a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>

Usage

<A
  ng-href="template">
...
</A>

Reference - AngularJS ngHref docs

55 questions
0
votes
2 answers

How to update the ng-href URl on $scope change

I'm looking to update the 'ng-href' url on scope value from controller.Initially on page load url is inserted fine. But then when i change the scope that URL should be updated //in my…
rUI
  • 13
  • 9
0
votes
1 answer

Ng-href Not Working

I have this code Which when hovered over shows nothing whereas this works And i have set…
0
votes
2 answers

Angular - Conditionally setting ng-href through function

I have an angular controller and I want to conditionally set links depending on the result of a function
user5680735
  • 703
  • 2
  • 7
  • 21
0
votes
0 answers

Dealing with a 404 for an ng-href

I'm stuck with an anchor that sets the ng-href to a server-stored variable and let's say, 1 in 300 return a 404 and that source is out of my hands to control.
0
votes
2 answers

AngularJs ng-href dynamic link with scope not updating/working

I am having a problem where an tag with an ng-href tag link with a scope parameter inside of it does update when the scope changes. I read in this answer (Why does the directive ng-href need {{}} while other directives don't?) that ng-href uses…
razorcat
  • 13
  • 1
  • 3
0
votes
2 answers

AngularJS ngHref inside ngRepeat doesn't evaluate value

I have the following markup:
0
votes
1 answer

Angularjs ng-href Bug?

I came across something strange and wanted to see if anyone had the same problem. I am using Angularjs with the ng-href directive within an ng-repeat as below. The issue I encountered is that if the ng-href tag just contains the {{var}}, it will do…
0
votes
1 answer

Change href can't update the data which bind to ng-src or ng-href

Html
{{result}}
JS App.controller('AppCtrl', function AppCtrl($scope){ $scope.result = "www.google.com"; } In a jquery file I can't modify because…
0
votes
2 answers

Stuck between ngRepeat, ngSrc, ngHref and JSON objects in AngularJS

I'm trying to set a simple ng-repeat but it doesn't work. I included angularJS, then two angular modules (ngTouch and ngAnimate because I need them for other purposes) and I included my Angular scripts files. I set the ng-repeat on a simple element…
LightBen
  • 95
  • 1
  • 12
-1
votes
2 answers

Angular ng-href doesn't work

I am using Chrome and have set up node server that is listening on port 8080 and provides all listed files. Angular app.js suppose to show the content of StuffView.html (simple text). index.html : …
mtx
  • 1,196
  • 2
  • 17
  • 41
1 2 3
4