我有angularjs选项卡,我需要在其中一个内部选择select2.select2在我的所有页面中进行woking而不是在tab中。 标签代码的一部分是:
<script type="text/ng-template" id="MetaIndicators.tpl.html" >
<div class="row col-xs-12" style=" margin-right:10px;margin-top:22px" >
<div class="form-group inline col-xs-12">
<div class=" form-group inline meta-form-groups col-xs-12">
<label class="metaLabels">ژانر</label>
<textarea name="Genre" data-kind="1" type="text" class=" form-control inline" ng-model="indicators1" ng-bind="indicators1" style="width:400px;float:right" readonly/>
<button class="btn btn-danger inline" style="margin-right: 35px;margin-top: 8px;" data-toggle="modal" data-target="#send-modal-IndicatorsGenre" ng-show="AllowEdit">ویرایش</button>
</div>
</div>
<div class="modal fade" id="send-modal-IndicatorsGenre" role="dialog" aria-hidden="true">
<div class="modal-dialog" style="background-color: white; margin-top: 100px;height: 179px; width:680px;">
<div class="modal-body" style="height:80%">
<form id="metaIndicatorsGenreInsert" class="form-horizontal" role="form">
<div class="col-xs-12" style="margin-top:8px;">
<label for="GenreID" class="col-xs-1 control-label" style="width:59px">ژانر</label>
<div class="col-xs-10">
<select multiple id="e1" style="width:500px">
<option></option>
<option ng-repeat="gn in GenreID" value="{{ gn.Key }}" ng-model="gn.Value">{{ gn.Value }}</option>
</select>
</div>
</div>
<hr class="stylish" />
<div class="col-xs-12" style="margin-top:20px;">
<a href="#" data-id="" data-name="openModal" data-task="submit" data-forms="#formMetaIndicatorsGenreInsert" data-method="post" data-action="InsertMetaIndicatorsGenre" data-results="#send-results" data-identifier="do-send" class="btn btn-success pull-right "><i class="fa fa-mail-forward"></i> ثبت </a>
<a href="#" data-dismiss="modal" class="btn btn-default pull-left">انصراف</a>
</div>
</form>
</div>
</div>
</div>
</script>
我添加select2.min.js和select2.min.css来索引。
填充选择的功能是:
function GetGenreListData() {
var Genre = metaService.CallService('get', "basic/GenreID", "");
Genre.success(function (data) {
$scope.GenreID = data;
}).error(function (data, status) {
alert($cookies.get('searchedMeta') + data.status);
});
}
和设置select2的功能是:
$("#e1").select2({
closeOnSelect: false
});
非常感谢