Ngx-bootstrap: ButtonCheckboxDirective active class not reacting on model changes

Created on 9 Mar 2018  路  2Comments  路  Source: valor-software/ngx-bootstrap

When binding the ButtonCheckboxDirective to a model with two way bindings, then when changing the model, I can debug that the state property is changing, however the active css class is not removed. Which means Angular is not refreshing the host binding. Adding a crd.markForCheck will solve this. This is done already in the RadioCheckboxDirective which was working fine already.

ButtonCheckboxDirective.prototype.writeValue = function (value) {

    this.state = this.trueValue === value;
    this.value = value ? this.trueValue : this.falseValue;
    this.cdr.markForCheck();
};

When adding markForCheck then the ui is nicely refreshed.

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 2.0.2

Angular: 5

Bootstrap: 4

Build system: Angular CLI, System.js, webpack, starter seed:

comp(buttons)

Most helpful comment

Can we get a fix for this bug?

All 2 comments

Hi, what is the expected solution date for this really simple issue?

Can we get a fix for this bug?

Was this page helpful?
0 / 5 - 0 ratings