Is it possible to disable one (or few) buttons in button group?
I tried [disabled] - it is not working.
prior to upgrading to Angular 2.1.2, ng2-bootstrap 1.1.16, [disabled]=condition worked for btnRadio.
I believe it was ng2-bootstrap 1.0.6.
I have a test page with:
dropdownToggle: [disabled] functions as expected
btnRadio: [disabled] fails
btnCheckbox: [disabled] fails
with the checkbox and radio the attribute 'ng-reflect-disabled="true"' is added however the 'disabled' attribute is not added to the DOM tag (button, label, div)
In the dropdown-toggle directive I noticed it has @HostBinding('class.disabled') which is not in the button directives...
ping
Thanks, we'll look at this.
any update on the fix?
Waiting for merge :-|
still waiting....
still.. waiting.
waiting....
still waiting...this merge is taking forever apparently :)
Hi! I'm running into the same issue. Any idea when the code will be merged?
Thanks!
Rob
+1, any updates on this?
Is there any updates to this issue? For anyone looking for a workaround, you might be able to do something like this:
<ng-container *ngFor="let option of options">
<button
*ngIf="!someDisableCondition"
[(ngModel)]="myModel"
[btnRadio]="option.id"
>
{{ option.name }}
</button>
<button
*ngIf="someDisableCondition"
disabled
[(ngModel)]="myModel"
[btnRadio]="option.id"
>
{{ option.name }}
</button>
</ng-container>
Works on 2.0.0-rc.0 (https://stackblitz.com/edit/ngx-bootstrap-3aabbe?file=app/app.component.html), closing as works as expected.
I don't think this is actually solved (for the OP and others):
Adding disabled does in fact disable the button, while [disabled]="true" (or applying any other expression that evaluates to true) does not, visually. The click event is suppressed, but the button still looks like it is enabled.
Apparently in this case setting the disabled property to true does not add the disabled attribute.
+1
Still an issue
@SergeyKuryatnick @IlyaSurmay please see https://ngx-bootstrap-4am3wr.stackblitz.io
Most helpful comment
I don't think this is actually solved (for the OP and others):
Adding
disableddoes in fact disable the button, while[disabled]="true"(or applying any other expression that evaluates totrue) does not, visually. Theclickevent is suppressed, but the button still looks like it is enabled.Apparently in this case setting the
disabledproperty to true does not add thedisabledattribute.