Skip to content

Support live option for observable objects #540

@chilversc

Description

@chilversc

I have some properties that contain 0 or 1 items that either start as null or can change their instance in the future. These properties are not included in the validation even when live is true.

Currently I'm using the following as a work around:

this.valueForValidation = ko.observableArray([null]);
this.value = ko.computed({
    read: function() { return this.valueForValidation()[0]; },
    write: function(value) { this.valueForValidation([value]); },
    owner: this
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions