HTML 视图部分,每次单击 prev 和 next 按钮时 viewCategory 功能将起作用:
<div class="subheader">
<ul class="categories">
<li ng-repeat="cat in categoryList" ng-class="{selected: cat.selected}">
<a ng-click="viewCategory(cat.name, cat._id)">{{cat.name}}</a>
</li>
<button class="arrow-left" ng-click="prevList($event)"></button>
<button class="arrow-right" ng-click="nextList($event)"></button>
</ul>
</div>
控制器部分:
$scope.nextList = function (e) {
var ele = e.target;
$(ele).parent().find('li.selected').removeClass('selected').next().addClass('selected').triggerHandler('click');
};
prev 功能也一样但是触发器不起作用....请帮帮我..提前谢谢....