-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(buttons): add support for checkbox buttons #1688
feat(buttons): add support for checkbox buttons #1688
Conversation
@maxokorokov could you PTAL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some minor comments.
Like the naming now 👍
src/buttons/checkbox.ts
Outdated
checked; | ||
|
||
/** | ||
* A flag indicating if a given radio button is disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
radio button → checkbox
|
||
@Directive({selector: '[ngbButtonLabel]', host: {'[class.btn]': 'true'}}) | ||
export class NgbButtonLabel { | ||
constructor(private _renderer: Renderer2, private _elRef: ElementRef) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True that we could have done it with 3 fields and host bindings, don't really need Renderer, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, will send a follow up PR to refactor it. Just didn't want to make too many changes in one PR.
* specified via ngModel. | ||
*/ | ||
@Directive({ | ||
selector: '[ngbButton][type=checkbox]', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, that's a much better solution!
src/index.ts
Outdated
@@ -27,7 +27,7 @@ export { | |||
NgbPanelContent | |||
} from './accordion/accordion.module'; | |||
export {NgbAlertModule, NgbAlertConfig, NgbAlert} from './alert/alert.module'; | |||
export {NgbButtonsModule, NgbRadioGroup} from './buttons/radio.module'; | |||
export {NgbButtonsModule, NgbRadioGroup} from './buttons/buttons.module'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems strange, that we have only NgbRadioGroup
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so people can query for it. We could add the new checkbox button here as well.
BREAKING CHANGE: The `NgbButtonsModule` changed location (path) and content. This path might need adjusting for people importing individual modules. Before: `import {NgbButtonsModule} from './buttons/radio.module'` After: `import {NgbButtonsModule} from './buttons/buttons.module'` The `NgbButtonsModule` now contains both checkbox and radio buttons. Closes #890
Closes #890