角带崩溃的插件,在当时打开多个面板(?) [英] Angular-Strap collapse plugin, opening more than one panel at the time (?)
问题描述
您好乡亲,这是插件 http://mgcrea.github.io/angular-表带/ ##倒塌
我想在我的应用程序来使用这个插件,但不这样做我想要什么,我想更动态地使用它,因为你可以在网页上看到的例子,你可以仅在打开一个面板的时间,我想给到用户有开放尽可能多的面板,因为他们想要的选项,这是我的html:
I am trying to use this plugin in my app but isn't doing what I want, I want to use it more dynamically, as you can see in the example on the web page, you can have only one panel open at the time, and I want to give to the users the option to have open as many panels as they want, and this is my html:
<div class="panel-group" ng-model="panels.activePanel" bs-collapse>
<div class="panel panel-default"
ng-repeat="sport in sports" ng-show="sport.leagues.length">
<div class="panel-heading"
bs-collapse-toggle
ng-click="addSportToLines(sport)">
<h4 class="panel-title">
<a>
{{::sport.name }}
</a>
<span class="pull-right badge">{{::sport.leagues.length }}</span>
</h4>
</div>
<div class="panel-collapse" bs-collapse-target>
<div class="panel panel-default">
<div class="list-group">
<a href="javascript:void(0);"
class="list-group-item panel-padding"
ng-repeat="league in sport.leagues"
ng-class="{active: league.active}"
ng-click="addLeagueToLines(league)">{{:: league.name }}</a>
</div>
</div>
有没有办法做到这一点还是我需要使用另一个工具?
is there a way to do it or I need to use another tool ?
推荐答案
如果你看一下源$ C $ C对角带崩溃控制的这里,你会发现在控制器内该功能:
If you look at the source code for the angular-strap collapse control here, you will notice this function inside the controller:
self.$setActive = $scope.$setActive = function(value) {
if(!self.$options.disallowToggle) {
self.$targets.$active = self.$targets.$active === value ? -1 : value;
} else {
self.$targets.$active = value;
}
self.$viewChangeListeners.forEach(function(fn) {
fn();
});
};
正如你所看到 $的目标。$主动
是一个单值,这意味着只有指令容纳一次打开的面板。要改变指令的功能,您将不得不叉它,并进行必要的修改。
As you can see $targets.$active
is a single value, meaning that the directive only accommodates one panel open at a time. To alter the functionality of the directive, you would have to fork it and make the necessary changes.
我想看看我的回答你类似的问题,作为一个更好的办法。你并不需要一个库/插件,让你正在寻找的结果。请参阅: http://stackoverflow.com/a/27611923/277697
I would look at my answer to your similar question as a better approach. You do not need a library/plugin to get the result you are looking for. See: http://stackoverflow.com/a/27611923/277697
这篇关于角带崩溃的插件,在当时打开多个面板(?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!