Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

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>
share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
1  
Thank you, it worked! Did not know I can directly refer as x.id without {{ }}. – user2934433 Jul 6 at 7:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.