我有多个元素,显示带有“相应标签”的图标。点击任何图标后,我想显示下一步。我可以简单地将ng-click事件处理程序附加到DOM元素的EACH以触发函数。我想找一个“清洁”的方式,我可以有一个“ng-click”,适用于每个元素(总共8个)。我是angularJS的新手,并没有找到替代方案。谢谢!
<ul class="list-inline row">
<li class="col-sm-3">
<div class="col-sm-6" ng-click="displayStep2"><span class="glyphicon glyphicon-cutlery"></span>
<p>Cutlery & Service</p>
</div>
<div class="col-sm-6"><span class="glyphicon glyphicon-off"></span>
<p>AV Equipment</p>
</div>
</li>
<li class="col-sm-3">
<div class="col-sm-6"><span class="glyphicon glyphicon-wrench"></span>
<p>Furniture & Fixtures</p>
</div>
<div class="col-sm-6"><span class="glyphicon glyphicon-pencil"></span>
<p>Supplies</p>
</div>
</li>
<li class="col-sm-3">
<div class="col-sm-6"><span class="glyphicon glyphicon-road"></span>
<p>Transportation</p>
</div>
<div class="col-sm-6"><span class="glyphicon glyphicon-stats"></span>
<p>Set Up & Clean Up</p>
</div>
</li>
<li class="col-sm-3">
<div class="col-sm-6"><span class="glyphicon glyphicon-envelope"></span>
<p>Shipment Tracking</p>
</div>
<div class="col-sm-6"><span class="glyphicon glyphicon-sort"></span>
<p>Temperature</p>
</div>
</li>
</ul>
<script>
$scope.displayStep2 = function(){
window.location.href = "/requestPortal/meeting/2/request/create";
};
</scirpt>