I don't really understand what the problem is. I copied your template in the snippet below and added a simple controller with a working example.
The angular-bootstrap module is not included so you don't get the proper rendering. But it shows you how to define the function in your controller for your template to work.
function ctrl($scope) {
// dummy users data for the snippet purpose
$scope.users = [{
name: 'Joe',
id: '1',
data : 'Married to Jane',
},
{
name: 'John',
id: '2',
data : 'Has 3 children',
},
{
name: 'Jack',
id: '3',
data : 'Owns a boat',
},
{
name: 'Bob',
id: '4',
data : 'Speaks swedish',
}
];
$scope.load_userdata = function(user_id) {
console.log("Loading user#%s data", user_id);
// looking for the right user :
let user = $scope.users.find(x => x.id === user_id);
// and toggling the dataLoaded property in the user object
user.dataLoaded = true;
}
}
<!DOCTYPE html>
<html ng-app>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<title>Angular JS Demo</title>
</head>
<body ng-controller="ctrl">
<uib-accordion close-others="oneAtATime">
<div uib-accordion-group class="panel-default" ng-repeat="user in users">
<uib-accordion-heading ng-click="load_userdata(user.id)">
<div class="table">
<div style="width: 50%">
@{{user.name}}
</div>
<div>
Load user data
</div>
</div>
</uib-accordion-heading>
<div ng-show="user.dataLoaded">
User's details :
{{user.data}}
</div>
</div>
</uib-accordion>
</body>
</html>