Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clicking on Angular UI Bootstrap Radio Buttons

I'm trying to use the radio buttons implemented in UI Bootstrap firing a function by including a ng-click on the button. Apparently the radio button variable updates after the function has been called. I've created a Plunker to show this behaviour and explain the problem where the function fires an alert with the content of the variable.

Radio Buttons Plunker

Is there a simple way of solving this issue. Maybe by making the function to wait for the variable to update...

like image 642
prl900 Avatar asked Jun 25 '14 00:06

prl900


1 Answers

Yep, simple fix. Use ng-change instead of ng-click on your radio buttons.

See http://plnkr.co/edit/0Jf4qrpHAXY8MeeVA3kl?p=preview

like image 88
Jonathan Wilson Avatar answered Sep 26 '22 14:09

Jonathan Wilson