angularjs'ng-href'无效

sfa*_*fas 2 javascript angularjs

我正在尝试使用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>                                     
Run Code Online (Sandbox Code Playgroud)

$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;


 });
Run Code Online (Sandbox Code Playgroud)

chr*_*ris 8

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

<a ng-href="http://www.proj.com/{{ parcel.id }}/edit/"/>{{ parcel.id }}
Run Code Online (Sandbox Code Playgroud)

至:

<a ng-href="http://www.proj.com/{{ parcel.id }}/edit/">{{ parcel.id }}</a>
Run Code Online (Sandbox Code Playgroud)

  • 是的,这一刻在这里有清楚的描述:[https://docs.angularjs.org/api/ng/directive/ngHref](https://docs.angularjs.org/api/ng/directive/ngHref) (2认同)