Angular js Controller method from HTML with a parameter

user2934433

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

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Send parameter from html to method in controller

From Dev

calling method from one controller to another controller in angular js

From Dev

angular js, passing data as parameter from view to controller

From Dev

How to call controller method from the app.js in angular

From Dev

Passing variable from ts to html as method parameter in Angular

From Dev

angular directive call to controller method with parameter

From Dev

Array key value get in html from controller in angular js?

From Dev

Angular JS not getting scope value from HTML to controller

From Dev

unable to pass username and password to controller from the html page in angular js

From Dev

Getting an image to my html from my controller in angular.js

From Dev

angular js: Not able to pass value from controller to html of an included page

From Dev

Taking default value of Int when parameter is passed from Angular service from WebApi controller method

From Dev

How to get parameter from Controller method in codeigniter?

From Dev

Angular pass parameter from Template to Controller and from Controller to service

From Dev

Angular: Passing parameter from Controller to Factory

From Dev

Passing Parameter to Angular Factory from controller

From Dev

Angular JS: Route provider controller method not called?

From Dev

Passing a Parameter from .js file to controller

From Dev

sails.js access controller method from controller method

From Dev

Angular.js: How to update data from one HTML to other HTML which uses same controller

From Dev

How can I access the "this" of an angular js controller, from inside a promise method?

From Dev

angular js call a method for a controller inside another controllers method

From Dev

Pass array variable from controller to html in Angular

From Dev

Getting rendering html from angular controller

From Dev

Reference function from angular controller in html

From Dev

Output HTML in Angular, from C# Controller

From Dev

How to append Query parameter in the URL from the controller method in Grails?

From Dev

passing parameter values from view to controller action method?

From Dev

Get any parameter from a Post Method in a Web Api controller

Related Related

  1. 1

    Send parameter from html to method in controller

  2. 2

    calling method from one controller to another controller in angular js

  3. 3

    angular js, passing data as parameter from view to controller

  4. 4

    How to call controller method from the app.js in angular

  5. 5

    Passing variable from ts to html as method parameter in Angular

  6. 6

    angular directive call to controller method with parameter

  7. 7

    Array key value get in html from controller in angular js?

  8. 8

    Angular JS not getting scope value from HTML to controller

  9. 9

    unable to pass username and password to controller from the html page in angular js

  10. 10

    Getting an image to my html from my controller in angular.js

  11. 11

    angular js: Not able to pass value from controller to html of an included page

  12. 12

    Taking default value of Int when parameter is passed from Angular service from WebApi controller method

  13. 13

    How to get parameter from Controller method in codeigniter?

  14. 14

    Angular pass parameter from Template to Controller and from Controller to service

  15. 15

    Angular: Passing parameter from Controller to Factory

  16. 16

    Passing Parameter to Angular Factory from controller

  17. 17

    Angular JS: Route provider controller method not called?

  18. 18

    Passing a Parameter from .js file to controller

  19. 19

    sails.js access controller method from controller method

  20. 20

    Angular.js: How to update data from one HTML to other HTML which uses same controller

  21. 21

    How can I access the "this" of an angular js controller, from inside a promise method?

  22. 22

    angular js call a method for a controller inside another controllers method

  23. 23

    Pass array variable from controller to html in Angular

  24. 24

    Getting rendering html from angular controller

  25. 25

    Reference function from angular controller in html

  26. 26

    Output HTML in Angular, from C# Controller

  27. 27

    How to append Query parameter in the URL from the controller method in Grails?

  28. 28

    passing parameter values from view to controller action method?

  29. 29

    Get any parameter from a Post Method in a Web Api controller

HotTag

Archive