javascript - Change radio model on button click [angularjs] -


What do I want to achieve, when I click on the button change input, the model of the radio changed "value" goes . Why do I need to double click, so that the model can be updated and the radio is checked?

  & lt; Div ng-app ng-controller = "Ctrl" & gt; & Lt; Input type = "radio" ng-model = "value" ng-value = "33" & gt; & Lt; Input type = "radio" ng-model = "value" ng-value = "22" & gt; {{Value}} & lt; Button onclick = "changeInput ()" & gt; Input input & lt; / Button & gt; & Lt; / Div & gt;   

JS

  function Ctrl ($ scope) {} function changeInput () {$ ('input: eq (0)'). Click () .click (); } 

The probability is because the value is updated before your onclick function. Why do not you update the value in your onclick function and use only one click?

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -