javascript angularjs 'ng-href' 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25141383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 04:02:09  来源:igfitidea点击:

angularjs 'ng-href' not working

javascriptangularjs

提问by sfas

I'm trying to create a link to each id using angularjs ng-href but when I refresh the page, the links don't show up. I even closed the browser and cleared the cache yet nothing is happening. Here is my current code:

我正在尝试使用 angularjs ng-href 创建指向每个 id 的链接,但是当我刷新页面时,链接不显示。我什至关闭了浏览器并清除了缓存,但什么也没发生。这是我当前的代码:

 <tr ng-repeat="parcel in parcels">
<td><a ng-href="http://www.proj.com/{{ parcel.id }}/edit/"/>{{ parcel.
 id }}</td>
<td>{{ parcel.tracking_id }}</td>
<td>{{ parcel.shipper_ref_no }}</td>                                     

$scope.parcels = [];
$scope.scans = [];
$scope.missings = [];
$scope.excludeds = [];

$scope.parcels = Outbound.summaryPageData.parcels;
$scope.scans = Outbound.summaryPageData.scans;
$scope.missings = Outbound.summaryPageData.missings;
$scope.excludeds = Outbound.summaryPageData.excludeds;


 });

回答by chris

I think it's a simple HTML syntax error - the <a>tag has no content. Try changing this:

我认为这是一个简单的 HTML 语法错误 -<a>标签没有内容。尝试改变这个:

<a ng-href="http://www.proj.com/{{ parcel.id }}/edit/"/>{{ parcel.id }}

to:

到:

<a ng-href="http://www.proj.com/{{ parcel.id }}/edit/">{{ parcel.id }}</a>