With angularjs I have the following execute()
function,it print the value of checked radio button
and it works fine,but I need to execute this function when page loaded just if one radio button
has checked.
-in this case when page loaded it should print 3 in console
-if vm.value=null
function shouldn't execute
I need to trigger function only if one radio button has checked
vm.value="3";
vm.execute=function(value){
console.log(value);
}
Html code
<input type="radio" ng-change=vm.execute(1) value="1" ng-model="vm.value">
<input type="radio" ng-change=vm.execute(2) value="2" ng-model="vm.value">
<input type="radio" ng-change=vm.execute(3) value="3" ng-model="vm.value">
<input type="radio" ng-change=vm.execute(4) value="4" ng-model="vm.value">