Skip to content

Commit

Permalink
Merge pull request #19322 from cincodenada/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored Jan 13, 2021
2 parents 8816a25 + c1087f5 commit c96143b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/@ember/-internals/routing/lib/ext/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ ControllerMixin.reopen({
If you give the names `['category','page']` it will bind
the values of these query parameters to the variables
`this.category` and `this.page`.
By default, Ember coerces query parameter values using `toggleProperty`.
This behavior may lead to unexpected results.
Available queryParam types: `boolean`, `number`, `array`.
If query param type not specified, it will be `string`.
To explicitly configure a query parameter property so it coerces as expected, you must define a type property:
By default, query parameters are parsed as strings. This
may cause unexpected behavior if a query parameter is used with `toggleProperty`,
because the initial value set for `param=false` will be the string `"false"`, which is truthy.
To avoid this, you may specify that the query parameter should be parsed as a boolean
by using the following verbose form with a `type` property:
```javascript
queryParams: [{
category: {
type: 'boolean'
}
}]
```
Available values for the `type` parameter are `'boolean'`, `'number'`, `'array'`, and `'string'`.
If query param type is not specified, it will default to `'string'`.
@for Ember.ControllerMixin
@property queryParams
Expand Down

0 comments on commit c96143b

Please sign in to comment.