Angular 来自 HTML 的带有参数的 js 控制器方法

Angular js Controller method from HTML with a parameter

有人可以帮助我处理以下情况吗?

我有一个手风琴,点击手风琴它会展开。

取决于header点击我想加载数据,甚至预加载数据。

我在控制器中有一个具有以下签名的函数

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

手风琴如下

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

根据您的问题,您似乎希望在单击 header 时显示数据?就这样做

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

并且在控制器中你会得到 'x',因此显示基于 x 的详细信息。