1

Could someone please help me in dealing the below situation.

I have an accordion, on click of accordion it expands.

Depending on header clicked I would like to load the data, or even preload the data.

I have a function in controller with below signature

$scope.getDetailsFn = function(Id){
    $scope.Details = "I am possible"
};

Accordion is as follows

<uib-accordion close-others="oneAtATime" >
   <uib-accordion-group heading="{{x.id}}" ng-repeat="x in xs" >
      //Is the below possible or calling the below on ng-click possible
      {{getDetailsFn({{x.id}})}}
      {{Details}}
      Message: {{x.message}}
      </br>
   </uib-accordion-group>
</uib-accordion>

1 Answer 1

1

From your question, looks like you want to display the data on click of the header? Just do this

<uib-accordion close-others="oneAtATime" >
 <uib-accordion-group heading="{{x.id}}" ng-repeat="x in xs" ng-click="getDetailsFn(x.id)">
  {{Details}}
  Message: {{x.message}}
  </br>
 </uib-accordion-group>
</uib-accordion>

And in the controller you would get 'x', so show the details based on x.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, it worked! Did not know I can directly refer as x.id without {{ }}.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.