Javascript 在AngularJS中导航而不是使用标记的最佳实践是什么?
这是我的个人资料块代码:Javascript 在AngularJS中导航而不是使用标记的最佳实践是什么?,javascript,html,angularjs,Javascript,Html,Angularjs,这是我的个人资料块代码: <div class="avatars-list"> <a href="#" class="avatar-item"> <img src="img/users/user-1.jpg" alt="Avatar" class="img-fluid"> </a> <a href="#" class="avatar-item"> <img src="img/users/user-5.j
<div class="avatars-list">
<a href="#" class="avatar-item">
<img src="img/users/user-1.jpg" alt="Avatar" class="img-fluid">
</a>
<a href="#" class="avatar-item">
<img src="img/users/user-5.jpg" alt="Avatar" class="img-fluid">
</a>
</div>
我应该用一些,
实际上,我们可以为每个项目编写一个函数来导航到一个特定的页面 试试这个
关于html
最佳做法是使用
。它具有可访问性所必需的内置功能(例如处于焦点顺序并允许屏幕阅读器将其作为链接发布)。为什么不使用
?为什么您认为不应该?最好始终使用
标记进行导航。您总是可以在标签中添加一个ng点击
:
,但是,我们如何为每个标签提供不同的链接呢
<div ng-click="navigate()"></div>
$scope.navigate = function () {
window.location.href = 'http://www.google.com';
}