angularJS: how to revert / prevent radio button event?

前端 未结 2 1789
面向向阳花
面向向阳花 2021-01-13 03:40

i have a (non-working) example in http://jsfiddle.net/S2kc7/1/




        
2条回答
  •  一个人的身影
    2021-01-13 03:59

    The accepted answer does not covers scenerios which makes ajax calls on model change.

    You can completely prevent changes by surrounding radio inputs with label tag.

    
    
    
    
    $scope.confirmChange = function(event) {
       if(!confirm('sure?')) {
         event.preventDefault();
       } 
    };
    

提交回复
热议问题