Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buttons: NgbRadioLabel directive is too "agressive" #557

Closed
pkozlowski-opensource opened this issue Aug 9, 2016 · 1 comment
Closed

Comments

@pkozlowski-opensource
Copy link
Member

The NgbRadioLabel as implemented today prevents checkbox demo from working correctly. It is implementation is very simple:

@Directive({selector: 'label.btn', host: {'[class.active]': 'checked'}})
export class NgbRadioLabel {
  @Input() checked: boolean;
}

But if we move to NgModules this directive gets activated on all labels with the btn class (quite common scenario). And it can mess up scenarios like this:

  <label class="btn btn-primary" [class.active]="model.left">
    <input type="checkbox" [(ngModel)]="model.left"> Left (pre-checked)
  </label>

In this scenario [class.active]="model.left" will be overridden by the NgbRadioLabel directive and will never take effect. We can't remove active label when the directive is not used / manipulated from outside.

@pkozlowski-opensource
Copy link
Member Author

I've got a fix for it in 21fa9a2 but it is against the RC5 branch so will wait with opening a PR till we've got RC5 sorted out.

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

No branches or pull requests

1 participant