ui-select

Clear selected option in ui-select angular

走远了吗. 提交于 2019-12-18 10:38:45
问题 Anyone know how to clear the selected value of an ui-select box in angular? I want the functionality of select2 where you have a small x in the selectbox. Doesn't look like it's got the allow-clear method that select2 got. 回答1: If you are using the select2 theme there is an allow-clear option on the ui-select-match directive that does this for you. You will have the x on the right and you can clear it by clicking it. https://github.com/angular-ui/ui-select/wiki/ui-select-match Quick example:

Multi select based on another multi select

我只是一个虾纸丫 提交于 2019-12-13 17:25:21
问题 I need to filter city based on the country in these multi-selects. I used ui-select for multi-selects, Thanks to @tanmay. Please take a look at this fiddle. Fiddle 回答1: You can add a function on ng-change that will return all the cities for the selected country $scope.getCityList=function(){ var sampletemp = []; //temp array to hold filtered values $scope.selected.country.forEach(function(country) { //bjectFromArrayFilter --> A filter function that will do the filtering var temp =

UI-Select reset-search-input does not work

泄露秘密 提交于 2019-12-10 17:42:45
问题 Please see my code below, when a choice is select from an input by typing something in i.e "Fr" and all the countries starting with France would appear, however after the input is selected the input field does not get cleared <ui-select multiple ng-model="quote.targetLanguage" reset-search-input="true" theme="bootstrap" ng-disabled="disabled" close-on-select="false" style="width: 800px;"> <ui-select-match placeholder="Select person..."> {{$item.language}} </ui-select-match> <ui-select-choices

Angular ui-select multi select: Dropdown is not getting updated on selecting some items from the controller

自古美人都是妖i 提交于 2019-12-08 19:36:26
问题 On click of "select yellow color" button, I want to add yellow to the selected list. Yellow is getting selected, but the dropdown is still showing yellow. In the same way, I want to deselect yellow on click of "deselect yellow color" button. I am able to deselect yellow, but yellow is not appearing in the dropdown. Please help me with this issue. HTML: <ui-select multiple ng-model="multipleDemo.colors" theme="select2" ng-disabled="disabled" style="width: 300px;"> <ui-select-match placeholder=

AngularJS: ui-select once selected not able to remove selected option apart from change option

主宰稳场 提交于 2019-12-07 17:56:46
问题 I am using ui-select for fetching data from server & populate it in drop down (search & select). I created a plunker for you. <ui-select ng-model="country.selected" theme="selectize" ng-disabled="disabled" style="width: 300px;"> <ui-select-match placeholder="Select or search a country in the list...">{{$select.selected.name}}</ui-select-match> <ui-select-choices repeat="country in countries | filter: $select.search"> <span ng-bind-html="country.name | highlight: $select.search"></span> <small

How to set a max length for the search input in (AngularJS) ui-select component?

ⅰ亾dé卋堺 提交于 2019-12-07 08:15:18
问题 Suppose I have the following (very basic) code for a ui-select <ui-select ng-model="vm.selected"> <ui-select-match> <span ng-bind="$select.selected.label"></span> </ui-select-match> <ui-select-choices repeat="item in vm.items"> <span ng-bind="item.label"></span> </ui-select-choices> </ui-select> Now, this generates all the html nodes, etc, which contain an input for searching and filtering the options displayed on the list. The problem is: How to set (in any variant) a maximum length for the

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

纵饮孤独 提交于 2019-12-07 06:02:46
问题 in angularjs i have a ui-select : <ui-select ng-model="itemSelected.selected" theme="selectize" ng-disabled="disabled"> <ui-select-match placeholder="Select an item...">{{$select.selected.Name}}</ui-select-match> <ui-select-choices repeat="item in itemsList"> <span ng-bind-html="item.Name"></span> </ui-select-choices> </ui-select> How can i select an item from code when i load the page? When i load the page in the controller i get the $scope.itemsList : how can i select a specific item from

How to set a max length for the search input in (AngularJS) ui-select component?

五迷三道 提交于 2019-12-05 18:13:09
Suppose I have the following (very basic) code for a ui-select <ui-select ng-model="vm.selected"> <ui-select-match> <span ng-bind="$select.selected.label"></span> </ui-select-match> <ui-select-choices repeat="item in vm.items"> <span ng-bind="item.label"></span> </ui-select-choices> </ui-select> Now, this generates all the html nodes, etc, which contain an input for searching and filtering the options displayed on the list. The problem is: How to set (in any variant) a maximum length for the input search ? The directive doesn't offer any built-in data-attribute for doing so. So, the expected

Angular ui-select: How to bind only selected value to ng-model

跟風遠走 提交于 2019-12-05 15:31:31
问题 $scope.property = new Property(); $scope.property.propertyType = {}; $scope.propertyTypes = [ { value: 'ResidentialPlot', name: 'Residential Plot' }, { value: 'CommercialPlot', name: 'Commercial Plot' }, { value: 'Apartment', name: 'Apartment/Flat' }, { value: 'Townhouse', name: 'Townhouse' }, { value: 'House', name: 'Single Family House' }, { value: 'Commercial', name: 'Commercial Property' } ]; <label for="ptype" class="col-sm-2 control-label">Property Type</label> <p>Populated: {{property

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

与世无争的帅哥 提交于 2019-12-05 09:42:11
in angularjs i have a ui-select : <ui-select ng-model="itemSelected.selected" theme="selectize" ng-disabled="disabled"> <ui-select-match placeholder="Select an item...">{{$select.selected.Name}}</ui-select-match> <ui-select-choices repeat="item in itemsList"> <span ng-bind-html="item.Name"></span> </ui-select-choices> </ui-select> How can i select an item from code when i load the page? When i load the page in the controller i get the $scope.itemsList : how can i select a specific item from the controller ? Thanks You can set that on controller load itself Markup <body ng-controller="DemoCtrl"