简体   繁体   中英

Status.Open not returning any value in Angular UI bootstrap Accordion

I am facing an issue with accordion of angular ui bootstrap. I am using accordion to show FAQs in my application.Now issue is "status.open" is not returning any value due to which 'chevron icon' class is not toggling.

Please see below code:

 <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>

I am using accordion through my own app and controller.

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();
                }
        };

I found solution of my problem :). Added

is-open="this.open"

<accordion-group ng-repeat="faq in FAQs" is-open="this.open" >

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM