Angularjs ng-paste on select component - angularjs

Is it possible to use ng-paste component on select components?
I can put it working on text componentes, but I want to do the same on Select Box. Imagine that I want 10 rows, if I paste the 9th value the ideal is to select them.
plunkr example :
<select ng-model="myselect" ng-options="o for o in options" ng-paste="paste2()" ></select>
plunk

Related

I am using ng-options to show data in select box but in option i have one hard-coded value is No-search how to show that value select at first

<div class="filter-box">
<select ng-model="$ctrl.customModel"
ng-options= 'option.id as option.name for option in transactionstatusList'
ng-change="transactionStatusChange()">
<option value="" selected="selected">No Search</option>
</select>
</div>
I am using angularjs ng-options to show data in select box but in option i have one hard-coded value is No-search how to show that value select at first because when data comes dynamically it shows first value from the data
Your code should work well if you have undefined customModel.
$scope.customModel;
Demo 1
However, if $scope.customModel is predefined, after async call, selected option jumps regards to ng-model
Demo 2

Bootstrap select picker with ng-repeat is not working for JSON object

I was using Bootstrap select for search and multiple select but the problem is when i am using $scope object in ng-repeat for options it's not working . I have given my codes below .
<select name="name" ng-model="city.id" class="selectpicker" data-live-search="true" ng-options="o._id as o.name for o in stateList" ></select>
<select name="name" ng-model="city.id" class="selectpicker" data-live-search="true" ><option ng-repeat="option in stateList" value="{[{option._id}]}">{[{option.name}]}</option>
I have used both options and ng-option methods but still the object didn't show up ...
This is my state object that need to be repeated in select...
$scope.stateList = [{"_id":"1","name":"www"},{"_id":"2","name":"bgg"}]
Hope you understand my problem and if you need any more details
pls leave a comment and i'm waiting for your suggestions...
I was having issues as well, but using nya-bootstrap-select
http://nya.io/nya-bootstrap-select/#!/
fixed it. It has something to do with bootstrap select's use of jQuery which doesn't always play nice with angular...this is written in Angular for use with Angular, so its more compatible...

Angular JS - Update input options with other input options

I have a form where I have to enter a country from a list in order to add different shipping costs to a total. As I am using ngCart directive, I have to use ng-click in order to send that info to the directive.
The problem is that I have two different input options with the same fields in different parts of the form, and I would like to update the value of one when I manually change the other, so that displayed option is always the same in both inputs.
I attach a http://jsfiddle.net/nf2z1a00/ with my code. Thanks in advance!
You can use ng-model on the select and use ng-options to take care of the options and the shipping like this:
<select ng-model="selectedCountry" ng-options="country.name for country in countries" ng-change="changeChipping()">
</select>
I've update your fiddle here
Put same ng-model in you similar select boxes :
<select ng-model="shippingCountry">
//first
</select>
<select ng-model="shippingCountry">
//second : notice the same ng-model
</select>

Link two select inputs in angularjs

I'm trying to link two select inputs, so when I change one the other will change based on the selected value in the first select input.
I used ng-options for that, as following :
first select :
ng-options="region.codeRegion as region.nomRegion for region in regions"
second select :
ng-options="province.codeProvince as province.nomProvince for province in candidature.resident.eps.region.provinces track by province.codeProvince"
for the data I'm using you can find it in the plunker below.
the first select is working but the second didn't work.
Here is a plunker for it : http://plnkr.co/edit/HLCIw099H4UYkGg4s78h?p=preview
How can I solve this ?
You should have ng-model="selectedRegion on your first select, and on the second select list options based on selectedRegion.
<select ng-options="region.nomRegion for region in regions" ng-model="selectedRegion"></select>
<select ng-options="province.codeProvince for province in selectedRegion.provinces track by province.codeProvince" ng-model="candidature.resident.eps.province"></select>
Here is the updated plunker

How to get the string value only in select tag angular?

http://plnkr.co/edit/SxdjrBeUF48DrdFQuFHz?p=preview
I have a selected and I want to get the value only.
this is what I currently getting
{"_code":"AUD","description":"AUD - Australian Dollar"}
what I want to get
"AUD"
how can I accomplish this, below is my code.
<select ng-model="myModel"
ng-options="o.description for o in currencies track by o._code">
</select>
Note: I can't ng-repeat my <option> tag instead, because I am trying to edit object and I want it to be selected in the select tag.
ng-options="o._code as o.description for o in currencies"
Plunk: http://plnkr.co/edit/UZy39F4CwX8Ey8WryWVm?p=preview

Resources