Comments (4)
Then i tried to help myself using dynamic options. I created this array in my viewmodel:
$scope.GuidanceInitiatorOptions = [
{
Id: Model.GuidanceInitiator.Customer,
DisplayName: "Beratungswunsch durch Kunden"
},
{
Id: Model.GuidanceInitiator.Analyst,
DisplayName: "Beratung durch Beraterinitiative"
},
];
and modified my html to:
<ol class="nya-bs-select form-control" ng-model="testmodel">
<li class="nya-bs-option" nya-bs-option="option in GuidanceInitiatorOptions track by option.Id">
<a>{{option.DisplayName}}</a>
</li>
</ol>
But this always writes the full option-object into my ng-model "testmodel".But i only want to store the numeric value "Id"! I tried to change the select-statement to "option.Id as option in GuidanceInitiatorOptions". But that gives exceptions in your code.
Whats the correct way to bind to the Id in this case? Looks like there is no example for this in your collection.
from nya-bootstrap-select.
You need to use value expression in each option, see the example of Value Expression
In your second example, you can add a attribute value="option.Id"
to nya-b-option
directive
<ol class="nya-bs-select form-control" ng-model="testmodel">
<li class="nya-bs-option" value="option.Id" nya-bs-option="option in GuidanceInitiatorOptions track by option.Id">
<a>{{option.DisplayName}}</a>
</li>
</ol>
from nya-bootstrap-select.
Can we add ng-change to nya-bs-select dropdown??
If yes,please share some example
from nya-bootstrap-select.
ng-change relies on the native form controls, this directive is not a native form control
from nya-bootstrap-select.
Related Issues (20)
- Custom Html selected value HOT 2
- IE Scrollbar bug HOT 3
- Support for binding actions-box, multiple, live-search HOT 3
- searchbox keydown error due to conflict with bootstrap-select plugin
- FIX: Need to double click on get focus in order to open the select list HOT 1
- Live search does not working properly with grouped list
- by default select one option in dropdown HOT 1
- Dropup from bootstrap-select HOT 3
- selected items as deep copy HOT 7
- Live-search does not clear input after selecting an option HOT 1
- Dynamic attribute "multiple" HOT 1
- async data error HOT 2
- With Action Box & Multiple options, Select All and Deselect All does not work HOT 3
- Single selection drop-down unable to reset the values in nya bootstrap select in angular 1.5 HOT 19
- Changing the collection with a selected (no longer valid) modelValue results in first element selected HOT 3
- <i> as a tick
- In-built UI to clean model value HOT 2
- Update label when options are changing HOT 3
- Focus on selected item with live-search
- Not showing "show-menu-arrow" for initial default value HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nya-bootstrap-select.