Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

ng-uncheckable directive for hybrid ui.bootstrap.buttons #3604

Closed
xErik opened this issue Apr 30, 2015 · 3 comments
Closed

ng-uncheckable directive for hybrid ui.bootstrap.buttons #3604

xErik opened this issue Apr 30, 2015 · 3 comments

Comments

@xErik
Copy link

xErik commented Apr 30, 2015

The keyword uncheckable allows for hybrid checkbox-radio buttons.

It would be helpful if this keyword could be set via a directive ng-uncheckable, similar to ngChecked.

(I am new to Angular and don't understand how the ngChecked directive works yet. Otherwise I would simply copy and modify it.)

 <div class="btn-group">
        <label class="btn btn-success" ng-model="radioModel" btn-radio="'Left'" uncheckable>Left</label>
        <label class="btn btn-success" ng-model="radioModel" btn-radio="'Middle'" uncheckable>Middle</label>
        <label class="btn btn-success" ng-model="radioModel" btn-radio="'Right'" uncheckable>Right</label>
 </div>
@rvanbaalen
Copy link
Contributor

Can you provide a use case or a demo for this?

@xErik
Copy link
Author

xErik commented May 1, 2015

My app has a highly interdependent model and the hybrid-mode fits my needs perfectly.
But in my case, the hybrid-mode depends on the current state of the model. The same group of radio buttons may switched to hybrid mode, and at other times not.

  1. Without the hybrid-mode, I would need to add a Default-button with the value of nothing to allow the user to completely deselect a group of radio buttons.
  2. With hybrid-mode, the user is able to complete deselect a group of radio buttons. Without the need of a Default-button.
  3. In some cases the software selects/activates only one radio button and disables the other ratio buttons of the radio button group. Problem: With hybrid-mode enabled, the user would be able to de-select this one, computed choice. And thus, modify the model, even if it is forbidden.
  4. I could work around thus, by disabling this one, computed choice. Thus, hindering the user to click the radio button. But in fact, this button has not the logical state of disabled but of selected. It is a valid choice and should not be displayed as disabled.

Generally speaking, I feel that Angular should allow for changing all (or most) aspects of the the UI interactively.

@wesleycho
Copy link
Contributor

Maybe we could call it uib-uncheckable - I'm open to this feature. Would you like to try your hand at a PR implementing this directive along with the relevant tests?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants