TNG / ngqp

Declaratively synchronize form controls with the URL
https://tng.github.io/ngqp
MIT License
81 stars 8 forks source link

Programmatically set value of parameters inside a partition #143

Open Airblader opened 5 years ago

Airblader commented 5 years ago

What does the bug look like?

It should be possible to comfortable programmatically set the value of a query parameter inside a partitioned query parameter. There was a user report that there might be issues with that, so we need to triage, verify, fix and add a test for it.

How can this bug be reproduced?

public set max_age(value: number) {
    (this.paramGroup.get('ageRange') as PartitionedQueryParam<number>).queryParams[1].setValue(value);
}

Additional context

What does work is setting the value of the entire partitioned parameter:

public set max_age(value: number) {
    this.paramGroup.get("ageRange").setValue([paramGroup.get("ageRange").value[0], value]);
}