angularjs-ng-href

How to use ng-href with absolute url?

泪湿孤枕 提交于 2020-01-12 12:26:00
问题 I'm still new to angularjs, and I have a problem that I seem to not be able to find solution, and I don't have time to go look into angular source. This is my scenario: I have some json data with collection of urls that I want to show on screen. I have an element with ng-repeat="link in links" and inside I have <a ng-href="{{link.url}}">{{link.title}}</a> That works, but all links are pointing to mydomain/apppath/ valueoflink.title I want them to be absolute, only valueoflink.title without

AngularJS ng-href does not go to link

三世轮回 提交于 2020-01-03 08:33:15
问题 I've checked the docs and the ng-href not working thread on here already but I'm stumped. Does ng-href require a full path? Mine currently looks like <a ng-title="{{title.text}}" ng-id="{{id.num}}" ng-href="/page.php#param:{{id.num}}"><span>go here</span></a> , but when I click on it, while it changes the URL in the address bar of the browser correctly (and it's a legitimate URL; I can hit "enter" in the address bar and it will "go there"), it does not actually GO TO that page. What's going

AngularJS ng-href does not go to link

≯℡__Kan透↙ 提交于 2020-01-03 08:33:11
问题 I've checked the docs and the ng-href not working thread on here already but I'm stumped. Does ng-href require a full path? Mine currently looks like <a ng-title="{{title.text}}" ng-id="{{id.num}}" ng-href="/page.php#param:{{id.num}}"><span>go here</span></a> , but when I click on it, while it changes the URL in the address bar of the browser correctly (and it's a legitimate URL; I can hit "enter" in the address bar and it will "go there"), it does not actually GO TO that page. What's going

Why ng-href behaving weird while parsing geo string

三世轮回 提交于 2019-12-19 10:23:04
问题 I've multiple geo string like geo:0,0q=1+a+bc , and I'm gonna assign this to ng-href of the anchor tag. Like below I'm doing it. HTML <a ng-href="{{geoString}}">Location</a> </br> Above tag is rendering fine on HTML but adding unsafe: string geo:0,0q=1+a+bc inside href attribute Rendered HTML <a ng-href="geo:0,0q=12345+jefferson+st" href="unsafe:geo:0,0q=12345+jefferson+st">Location</a> Plunkr with demonstrating issue. I don't want unsafe: inside href , Any idea why it is pre-appending unsafe

AngularJS - change href Attribute based on current path

和自甴很熟 提交于 2019-12-12 02:07:41
问题 How can I change the value of the href-Attribute based on the current path? My if clause in AngularJS looks like this: if (newPath.indexOf('test') > -1) { // change the value of the href-Attribute } else { // don't change the value of the href-Attribute } My HTML looks like this: <li> <a aria-expanded="false" role="button" href="/path1/path2/path4">Downloads</a> </li> 回答1: you can use ng-href to dynamically assign value to href <li> <a aria-expanded="false" role="button" ng-href="{{myVar}}"

prioritize ngclick over nghref in <a> elements

荒凉一梦 提交于 2019-12-10 14:53:03
问题 tl;dr : How can I force angular to only execute the ngclick directive in an <a> element without emptying/removing the href ? My site has some custom behavior on some elements (modal opens, location bar updates, etc.) but for SEO indexing I also need it to be an <a> element with an href attribute containing a valid link. Such as: <a href="/{{item.url}}" ng-click="doCustomStuff(item)">some link</a> However, angular also executes the href and the routing makes my custom ng-click logic useless.

Why ng-href behaving weird while parsing geo string

安稳与你 提交于 2019-12-01 10:36:43
I've multiple geo string like geo:0,0q=1+a+bc , and I'm gonna assign this to ng-href of the anchor tag. Like below I'm doing it. HTML <a ng-href="{{geoString}}">Location</a> </br> Above tag is rendering fine on HTML but adding unsafe: string geo:0,0q=1+a+bc inside href attribute Rendered HTML <a ng-href="geo:0,0q=12345+jefferson+st" href="unsafe:geo:0,0q=12345+jefferson+st">Location</a> Plunkr with demonstrating issue. I don't want unsafe: inside href , Any idea why it is pre-appending unsafe: before geoString & How do i remove it? squiroid You need to use aHrefSanitizationWhitelist([regexp]);