我正在尝试在数组上使用 <a> 标签
I'm trying to use <a> tag on an array
<div class="shared-by-list" ng-show="dashpost.showPostSharedByList">
<span><small><strong><em>Shared by: </em></strong></small></span>
<span><small>{{dashpost.postSharedByList}}</small></span>
</div>
在上面的代码中,dashpost.postSharedByList
是共享特定 post 的一组名称。我必须包含一个 <a>
标签,其中 href
指向该特定配置文件。问题是超链接应用于数组中的所有名称。我想要数组中不同元素的不同链接。请帮忙!
<div class="shared-by-list" ng-show="dashpost.showPostSharedByList">
<div ng-repeat="postSharedBy in dashpost.postSharedByList">
<span><small><strong><em>Shared by: </em></strong></small></span>
<span><small><a ng-href="#/profile/{{postSharedBy}}">{{postSharedBy}}</a></small></span>
</div>
</div>
如果列表包含如下结构的对象会更好:
{name: "element name", anchorname: "element anchor" }
无论如何,这取决于你的选择。
<div class="shared-by-list" ng-show="dashpost.showPostSharedByList">
<span><small><strong><em>Shared by: </em></strong></small></span>
<span><small>{{dashpost.postSharedByList}}</small></span>
</div>
在上面的代码中,dashpost.postSharedByList
是共享特定 post 的一组名称。我必须包含一个 <a>
标签,其中 href
指向该特定配置文件。问题是超链接应用于数组中的所有名称。我想要数组中不同元素的不同链接。请帮忙!
<div class="shared-by-list" ng-show="dashpost.showPostSharedByList">
<div ng-repeat="postSharedBy in dashpost.postSharedByList">
<span><small><strong><em>Shared by: </em></strong></small></span>
<span><small><a ng-href="#/profile/{{postSharedBy}}">{{postSharedBy}}</a></small></span>
</div>
</div>
如果列表包含如下结构的对象会更好:
{name: "element name", anchorname: "element anchor" }
无论如何,这取决于你的选择。