Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index.html
- <link href="resources/css/bootstrap.min.css" rel="stylesheet">
- <link href="resources/css/bootstrap-select.css" rel="stylesheet">
- <!-- Bootstrap Core CSS -->
- <script src="resources/js/jquery-2.1.1.min.js"></script>
- <script src="resources/js/jquery-1.11.0.js"></script>
- <script src="resources/js/bootstrap-select.js"></script>
- <script src="resources/library/angular.js"></script>
- <script src="resources/library/angular-route.js"></script>
- <script src="resources/js/MainController.js"></script>
- <script src="resources/js/main-app.js"></script>
- partialview.html
- -------------------
- <select class="selectpicker" multiple ng-model="selE">
- <option ng-repeat="e in ee">{{e}}</option>
- </select>
- <script>
- $(document).ready(function () {
- $('select').selectpicker({
- style: 'btn-default',
- size: false
- });
- });
- </script>
- <select class="selectpicker"
- multiple
- title='Choose one of the following...'>
- <option>Mustard</option>
- <option>Ketchup</option>
- <option>Relish</option>
- </select>
- angular.module('demo')
- .directive('selectpicker', function () {
- return {
- restrict: 'C',
- link: function (scope, element) {
- $(element).selectpicker({
- style: 'btn-default',
- size: false
- });
- }
- };
- });
- angular.module('demo')
- .directive('selectpicker', function () {
- return {
- restrict: 'C',
- require: 'ngModel',
- link: function (scope, element, attrs, ngModel) {
- var $el = $(element);
- $el.selectpicker({
- style: 'btn-default',
- size: false
- });
- $el.on('change', function (ee, aa) {
- ngModel.$setViewValue($el.val());
- scope.$apply();
- });
- }
- };
- });
- angular.module('demo')
- .controller('MainCtrl', function ($scope) {
- $scope.selected = [];
- });
- <select ng-model="selected"
- class="selectpicker"
- multiple
- title='Choose one of the following...'>
- <option>Mustard</option>
- <option>Ketchup</option>
- <option>Relish</option>
- </select>
- <select ng-model="selected"
- class="selectpicker"
- multiple
- title='Choose one of the following...'>
- <option>Mustard</option>
- <option>Ketchup</option>
- <option>Relish</option>
- </select>
- angular.module('demo')
- .directive('selectpicker', function ($timeout) {
- return {
- restrict: 'C',
- require: 'ngModel',
- replace: true,
- template: '<select multiple><option ng-repeat="opt in options">{{ opt }}</option></select>',
- scope: {
- options: '='
- },
- link: function (scope, element, attrs, ngModel) {
- var $el = $(element);
- $timeout(function () {
- $el.selectpicker({
- style: 'btn-default',
- size: false
- });
- });
- $el.on('change', function (ee, aa) {
- ngModel.$setViewValue($el.val());
- scope.$apply();
- });
- }
- };
- });
- <div ng-model="selected"
- class="selectpicker"
- options="issues"
- title='Choose one of the following...'>
- </div>
Add Comment
Please, Sign In to add comment