HTML代码:在 li 标记
中无效的活跃课程<ul class="list-group">
<li class="list-group-item" ng-class="{'active': isSelectedBookmark(bookmark.id)}" ng-repeat="bookmark in bookmarks | filter:{category:currentCategory.name}">
<button ng-click="setEditedBookmark(bookmark); startEditing();" type="button" class="btn btn-link">
<span class="glyphicon glyphicon-pencil"></span>
</button>
<a href="{{bookmark.url}}" target="_blank">{{bookmark.title}}</a>
</li>
</ul>
javascript文件:
$scope.bookmarks = [
{'id':0, 'title':"AngularJs", 'url':"http://angularjs.org", 'category':"Development"},
{'id':1, 'title':"Egghead.io", 'url':"http://angularjs.org", 'category':"Development"},
{'id':2, 'title':"HTML", 'url':"http://w3schools.com", 'category':"Design"},
{'id':3, 'title':"CSS", 'url':"http://w3schools.com", 'category':"Design"},
{'id':4, 'title':"JavaScript", 'url':"http://w3schools.com", 'category':"Development"}
];
$scope.editedBookmark = null;
function setEditedBookmark(bookmark) {
$scope.editedBookmark = angular.copy(bookmark);
}
function isSelectedBookmark(bookmarkId) {
return $scope.editedBookmark !== null && $scope.editedBookmark.id === bookmarkId;
}
$scope.setEditedBookmark = setEditedBookmark;
$scope.isSelectedBookmark=isSelectedBookmark;
如何让活动类在这种情况下工作?