Tom Hammond
Tom Hammond

Reputation: 6080

Angular Bootstrap Radio Buttons Not Triggering Function

I have two radio buttons:

<div class="btn-group" data-toggle="buttons">
    <label class="btn btn-primary active">
        <input type="radio" name="options" id="server" 
               autocomplete="off" checked ng-model="app.callback_url" 
               ng-change="patchApp({callback_url:app.callback_url},app.callback_url)">
        Server-side Callback
    </label>
    <label class="btn btn-primary">
        <input type="radio" name="options" id="client" autocomplete="off" 
               ng-model="app.callback_url" 
               ng-change="patchApp({callback_url:app.callback_url},app.callback_url)"> 
        Client-side Callback
    </label>
</div>

They should be triggering a patchApp function: ng-change="patchApp({callback_url:app.callback_url},app.callback_url)

However, they do not. I've also tried ng-click="patchApp({callback_url:app.callback_url},app.callback_url) and that did not trigger the function either.

Any idea where I'm going wrong? It works just fine for a dropdown:

<select class="form-control col-md-7 col-xs-12" name="platform" 
        ng-model="app.platform" ng-change="patchApp({platform:app.platform},app.platform)">
    <option value="ios">iOS</option>
    <option value="android">Android</option>
    <option value="unity">Unity</option>
</select>

Upvotes: 0

Views: 98

Answers (1)

Gowthaman
Gowthaman

Reputation: 1282

You're missing ng-value. That is why your model is not getting assigned any values and ng-change is not triggered.

Upvotes: 2

Related Questions