jeudi 13 août 2015

Why is this angular ui-bootstrap select dropdown does not call the function on ng-click? [duplicate]

This question already has an answer here:

Below is a snippet of the code. I'm able to call the function if I was to use a regular button. However, if I was to use it as below, the function never gets called. The code below is in jade.

.col-sm-12.subSection(ng-controller="EnvSelector as envSelector")
    label Select Bucket
    select.form-control.btn.dropdown-toggle
        option(ng-repeat="bucket in envSelector.env.getBuckets()")
            a(href='#', ng-click='setBucket(bucket)') {{bucket.name}}

EDIT: The funny thing is, this approach works:

.col-sm-12(ng-controller="EnvSelector as envSelector")
    .btn-group(dropdown='', is-open='status.isopen')
        button.btn(type='button', dropdown-toggle='', ng-disabled='disabled')
            | {{envSelector.chosenBucket.name}}
            span.caret
    ul.dropdown-menu(role='menu')
        li(role='menuitem', ng-repeat='bucket in envSelector.env.getBuckets()')
            a(href='#', ng-click='setBucket(bucket)') {{bucket.name}}

However, I want to use the select approach. How can I make that work?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire