Giter VIP home page Giter VIP logo

Comments (4)

DJHightower avatar DJHightower commented on June 26, 2024

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.

lordfriend avatar lordfriend commented on June 26, 2024

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.

kumarabrol avatar kumarabrol commented on June 26, 2024

Can we add ng-change to nya-bs-select dropdown??
If yes,please share some example

from nya-bootstrap-select.

lordfriend avatar lordfriend commented on June 26, 2024

ng-change relies on the native form controls, this directive is not a native form control

from nya-bootstrap-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.