Skip to content Skip to sidebar Skip to footer

Find Out If Radio Option Is Checked Before It Was Clicked

I have the following radio group.

Solution 1:

You can watch this code in your controller. Now, whenever your model will be changed(in the ui or in the controller), this event will be raised.

$scope.$watch('group1', function (newValue, oldValue) {
   //Place your code here ...// You have access to the old and to the new Value
});

Just for your information, try to use at least watches as you can...

Solution 2:

js:

if(this.checked){

   alert("selected");

}else{

  this.checked=true;
}

put this code in a function and call it in onClick event of radio button

Post a Comment for "Find Out If Radio Option Is Checked Before It Was Clicked"