1

Closed

ViewModelBase's raisePropertyChanged not working correctly when value is boolean false

description

If the viewModel property is a Boolean and set to false, the dataContext is not changed because the if statement in the raisePropertyChanged function returns false.

I assume this was intended to check for null or undefined. I changed it to:
raisePropertyChanged(propertyName : string, value : Object) {
            if (this.dataContext && propertyName && (undefined != value)) {
                for (var property in this.dataContext) {
                    if (property === propertyName) {
                        this.dataContext[property] = value;
                    }
                }
            }
        }
It seems to work for me now.

comments

davidezordan wrote Jul 24, 2015 at 8:00 PM

Fixed 66e298ede277