使用AngularJS怎么实现一个折叠菜单效果
这期内容当中小编将会给大家带来有关使用AngularJS怎么实现一个折叠菜单效果,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

创新互联服务项目包括防城港网站建设、防城港网站制作、防城港网页制作以及防城港网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,防城港网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到防城港省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
具体如下:
',
controller : function() {
var expanders = [];
this.gotOpened = function(selectedExpander) {
angular.forEach(expanders, function(expander) {
if (selectedExpander != expander) {
expander.showMe = false;
}
});
}
this.addExpander = function(expander) {
expanders.push(expander);
}
}
}
});
expModule.directive('expander', function() {
return {
restrict : 'EA',
replace : true,
transclude : true,
require : '^?accordion',
scope : {
title : '=expanderTitle'
},
template : '
'
+ '
'
+ '
',
link : function(scope, element, attrs, accordionController) {
scope.showMe = false;
accordionController.addExpander(scope);
scope.toggle = function toggle() {
scope.showMe = !scope.showMe;
accordionController.gotOpened(scope);
}
}
}
});
expModule.controller("SomeController",function($scope) {
$scope.expanders = [{
title : '1',
text : '1.1.'
}, {
title : '2',
text : '2.2'
}, {
title : '3',
text : '3.3'
}];
});