我正面临 angular ui bootstrap 手风琴的问题。我正在使用手风琴在我的应用程序中显示常见问题解答。现在的问题是“status.open”没有返回任何值,因为“chevron icon”类没有切换。
请看下面的代码:
<div>
<accordion close-others="true">
<accordion-group ng-repeat="faq in FAQs">
<accordion-heading>
<div>
{{faq.title}}<i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-up': status.open, 'glyphicon-chevron-down': !status.open}"></i>
</div>
</accordion-heading>
<div ng-bind-html="faq.description"></div>
</accordion-group>
</accordion>
</div>
我通过自己的应用程序和控制器使用手风琴。
function ($scope, FAQService) {
$scope.FAQs = [];
$scope.GetFAQByCategory = function() {
$scope.response = '';
var responsePromise = FAQService.GetFAQs();
responsePromise.then(function(faqData) {
$(faqData).each(function(index, key) {
$scope.FAQs.push(
{
title: faqData[index].Title,
description: faqData[index].Description,
category: faqData[index].Category.Label
});
} );
});
if (!$scope.$root.$$phase) {
$scope.$apply();
}
};