How to do an accordion in an accordian with toggle functions?


#1

Hi I’m new to ionic i have been looking for tutorials for accordion list. i want to do an accordion in an accordion “a list in a list in a list”. lists in 3 levels. i can manage to do this but i cant toggle one list at a the time. all opens at the same time and shut at the same time. i understand that the same toggle code is applied to all the lists thats why they act that way. but how can i have separate toggles function for the lists in the lower levels.

HTML

  item lvl1           item lvl2           item lvl2

js

.controller(‘AppCtrl’, function($scope) {

$scope.toggleGroup = function(group) {

if ($scope.isGroupShown(group)) {
  $scope.shownGroup = null;
} else {
  $scope.shownGroup = group;
}

};
$scope.isGroupShown = function(group) {
return $scope.shownGroup === group;
};

thank you for your help in advances
/Fady