Menu
  • HOME
  • TAGS

programatically selected option is not hightlighted in ui-select

javascript,angularjs,ui-select2,ui-select

This is due to the following change in AngularJS 1.3.1: $observe: check if the attribute is undefined Ui-select uses $observe to set a default value for resetSearchInput: attrs.$observe('resetSearchInput', function() { var resetSearchInput = scope.$eval(attrs.resetSearchInput); $select.resetSearchInput = resetSearchInput !== undefined ? resetSearchInput : true; }); But since the change noted above...

item selected and selectable in ui-select2

angularjs,ui-select2

Actually I think I found an solution (to my own question): Based on the controller of the original question, change the array, before replacing it: function MyCtrl($scope) { // Averell is preselected (id:4) $scope.selectedDaltons = [4]; // $scope.daltons is iterated in ng-repeat // its initially called in ng-init $scope.buildList =...

Overriding Angular ui-select2 formatNoMatches in a directive

javascript,angularjs,angular-ui,ui-select2

I've finally managed to make it work: for some reason I haven't determined yet, setting the scope.select2Options inside a directive doesn't work, whereas it works inside a controller. I set it in the parent controller and passed it to the directive's scope with '=' and it works fine now.

how to add conditional to blank select2 option? :include_blank => true?

jquery,ruby-on-rails,jquery-select2,ui-select2,select2-rails

You can try this: $('.compare-search').on('change', function() { if ($(this).val().length) { $('.vScoreExplain').hide(); $('.stats').show(); } else { $('.vScoreExplain').show(); $('.stats').hide(); } }); ...

Select2 custom message formatting

jquery,ajax,angularjs,jquery-select2,ui-select2

Override formatResult and implement a custom behaviour. Eg. for a special property in your resultset (result.error): function formatResult(result, container, query, escapeMarkup) { var markup = []; if(result.error != undefined && result.error) { markError(result.text, markup); } else { Select2.util.markMatch(result.text, query.term, markup, escapeMarkup); } return markup.join(""); }; special format: function markError(text, markup)...

Why does $digest() is not being called automatically from Parse callback?

angularjs,ui-select2,angular-digest

That's because success is out of Angular's scope, you need to explicitly tell Angular that something was updated it must run $digest or $apply(which internally calls $digest) to update it's scope too. Angular will account for only those model changes which are done inside AngularJS’ context, it has no idea...

Select2 AJAX is not working

javascript,ajax,jquery-select2,ui-select2

First, you shoul ry to change the HTTP verb to GET, as you are not posting data to the server, you want to get data from it: ajax: { ... type: 'GET', ... } Secondly, you are expecting JSON from the server, but in the GetData method, you are creating...

SELECT2 Input Box Styling

html,jquery-select2,ui-select2,angularjs-select2

It appears that the "X" is actually an image: select2.png If you check your browser web tools network tab you can see this external resource loaded. I'm assuming it is part of the select2 plugin you are using. If you can find this image in the source of the plugin...

Angularjs and UI-Select: how to select an option from code

angularjs,angular-ui,ui-select2,ui-select

You can set that on controller load itself Markup <body ng-controller="DemoCtrl"> <p>Selected: {{item.selected}}</p> <ui-select ng-model="item.selected" theme="select2" ng-disabled="disabled" style="min-width: 300px;"> <ui-select-match placeholder="Select a item in the list">{{$select.selected.name}}</ui-select-match> <ui-select-choices repeat="item in items | propsFilter: {name: $select.search, age: $select.search}"> <div ng-bind-html="item.Code | highlight: $select.search"></div>...

$scope.$digest() doesn't populate select2 drop down list

angularjs,ui-select2,angular-digest

They're both pointing to the same scope model, carDetails.make. So, of course, the first will become null, because the second drop down list sets carDetails.make to null. Also, I don't think you need to use digest, although, you should be using $scope.$apply. But, angularjs should run the digest anyway.

UI-Select2 remove option from dropdown?

javascript,jquery,angularjs,ui-select2

Well, until somebody comes up with a neat solution, playing a bit with your plunker has yield this: $scope.items = $scope.items.slice(1, $scope.items.length); Check out this forked plunker....

ui-select2 and ng-required

angularjs,ui-select2,angularjs-select2

The Problem was that angular dosn't support dynamic form element: Issue #1404 https://github.com/angular/angular.js/issues/1404 Workaround (till 1.3 is out): app.config(['$provide', function($provide) { $provide.decorator('ngModelDirective', ['$delegate', function($delegate) { var ngModel = $delegate[0], controller = ngModel.controller; ngModel.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) { var $interpolate = $injector.get('$interpolate'); attrs.$set('name', $interpolate(attrs.name ||...

Format Select2 dropdown results having json

jquery,json,select,jquery-select2,ui-select2

in your select2 options pass a function something like this and style the classes however you need ... placeholder: "Select a Facility", formatResult: function(item) { return '<div class="facility">' + item.text + '</div><span class="city">' + item.city + '</city></div>'; }, ... you may need your .map function to include Facilityname and City...