How to get/set "checked" state on "button-bar" - component from AngularJS ?



  • How to get/set “checked” state on “button-bar” - component from AngularJS ?

        <div class="button-bar">                
         <div class="button-bar__item">
            <input type="radio" name="segment-a" checked>
            <button class="button-bar__button">Button1</button>
          </div>                      
          <div class="button-bar__item">
            <input type="radio" name="segment-a">
            <button class="button-bar__button">Button2</button>
          </div>                  
        </div>


  • I know you wanted Angular, but this is how in JS:

    document.querySelector('input[name=segment-a]:checked').value
    

    Hopefully, this helps or gets you started.


Log in to reply