I think this could be declarative:

    <div id="group-container" class="{{selected ? 'selected' : ''}}">