AngularJS - Trigger when radio button is selected
angularjs
Solution
There are at least 2 different methods of invoking functions on radio button selection:
1) Using `ng-change` directive:
<input type="radio" ng-model="value" value="foo" ng-change='newValue(value)'>
and then, in a controller:
$scope.newValue = function(value) {
console.log(value);
}
Here is the jsFiddle: http://jsfiddle.net/ZPcSe/5/
2) Watching the model for changes. This doesn't require anything special on the input level:
<input type="radio" ng-model="value" value="foo">
but in a controller one would have:
$scope.$watch('value', function(value) {
console.log(value);
});
And the jsFiddle: http://jsfiddle.net/vDTRp/2/
Knowing more about your the use case would help to propose an adequate solution.
Problem
I searched and tried many ng-xxxx kind of options but couldn't find the one.. I just want to call some function in the controller when radio button is selected. So it might be similar to following..(Of course, below code is not working) ``` <input type="radio" ng-model="value" value="one" ng-click="checkStuff()"/> ``` Is there any way to achieve what I want?