I'm using AngularJS 1 with the onsen framework to develop an app, and I'm trying out the following example:
angular.module('myApp', ['onsen', 'ngAnimate']).controller('MyCtrl', function($scope) {
$scope.groups = [];
for (var i = 0; i < 10; i++) {
$scope.groups[i] = {
name: i,
items: []
};
for (var j = 0; j < 3; j++) {
$scope.groups[i].items.push(i + '-' + j);
}
}
/*
* if given group is the selected group, deselect it
* else, select the given group
*/
$scope.toggleGroup = function(group) {
if ($scope.isGroupShown(group)) {
$scope.shownGroup = null;
} else {
$scope.shownGroup = group;
}
};
$scope.isGroupShown = function(group) {
return $scope.shownGroup === group;
};
});
In the example you can see, that they use the ng-show and ng-hide functions on the elements.
I tried the code out, myself, but couldn't get the list to collapse, since the ng-hide is not working.
I even downloaded the angular-animate.js module and loaded it, but it's not working.
Any tips?