It would be really great if you could pass null to the query params subexpression in a link-to. Today, if I pass null like this:
{{#link-to 'foo' (query-params test=null)}}...{{/link-to}}
I will end up on the route localhost:4200/foo?test=undefined because the subexpression is expecting null to be a variable it can access in my current context.
A common use case of doing something like this is with clearing a search. Imagine I've implemented a search query parameter and I want to implement an "X" to clear the search. In order to use a link-to and clear the query parameter, I have to put a variable called null in context for the link-to to clear the query param from the address bar.
App.FooController = Ember.Controller.extend({
queryParams: [q],
q: null,
null: null
});
Here's an example JSBin showing the issue I described.
It would be really great if you could pass
nullto the query params subexpression in alink-to. Today, if I passnulllike this:I will end up on the route
localhost:4200/foo?test=undefinedbecause the subexpression is expectingnullto be a variable it can access in my current context.A common use case of doing something like this is with clearing a search. Imagine I've implemented a search query parameter and I want to implement an "X" to clear the search. In order to use a link-to and clear the query parameter, I have to put a variable called
nullin context for the link-to to clear the query param from the address bar.Here's an example JSBin showing the issue I described.