-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query params does not work with computed property #9819
Comments
yes this is a known issue currently. cc @machty |
@bakura10 you can't use computer properties as QP default values. We may add something similar to such functionality soon but in the meantime you can try overriding the following methods either via |
I discovered thsoe two methods after posting this issue, and it works like a charm ;). |
👍 |
Having troubles with this. In my case I have a queryParam composed with two controller properties (JSBin). Cant use |
@machty for serializing your suggestion works perfect but are there already plans to use real computed properties for queryParams? Would be much cleaner then using the observer to set static properties. |
@alvinvogelzang some of the particulars of query params need to be reworked for Ember 2.0, particularly w.r.t routeable components, and I don't expect that Ember 1.x will see real computed property support for query params. |
@machty fair enough, thanks :) |
What's the status on this? QPs seem to work for one of my CPs, but a second one that depends on the same array isn't being updated on subsequent changes to the array. |
This is an unfortunate bug, because a user expects it to just work, and they spend so much time tracking down what the issue is. |
@knownasilya can you paste in some sample code of the QP/CP properties? |
@machty not sure if this is exactly the case that I was working with.. http://ember-twiddle.com/14de93b88b739b0495a3 |
Ran into this and spent a lot of time because I was just get a blank page and no error or warning. My computed property used to work under <= |
Depending on your situation, you may be able to do this in reverse. I am using a CP that is based on the query param. In my case, I am using pikaday which needs a JS Date but I want an ISO8601-style date in the URL. I could probably avoid using moment but it helps with the native Date timezone issues.
|
I ran into this problem as well in Ember >= 1.13 when using ember-cli-bootstrap-datepicker. My solution was to set the query params with actions and have a property compute off the QPs that turned it back into a date object. Any initialization can be done in the route |
@Ricky1981 You're on the right track but not complete, I write a simple example to show various situations based on your solution: https://ember-twiddle.com/6355950e9d06d9f83349 |
We'll have to agree to disagree @nightire as I prefer my own implementation. |
@Ricky1981 that was my solution too, except I needed to get the id from a model as the query param, but pass the actual model from my component to my controller (the CP was basically a store.peekRecord). Would be nice to be able to do this with both CPs and DS.Models but alas, that's a not-terrible workaround. |
Another one working solution here https://discuss.emberjs.com/t/passing-dynamic-query-params-as-an-object-in-link-to-helper/9136/3 |
Hi,
I have a case when I use Date objects as query params. However, I want them to be shown in day format (YYYY-mm-dd) in the URL. As Ember does not have any way (or did I miss it?) to deserialize an object when outputted as a URL, I'm forced to using a computed property, however it does not seem to work.
I've written a reproducible JSBin that shows the problem (on Ember 1.8.1): http://emberjs.jsbin.com/qijorojoci
The text was updated successfully, but these errors were encountered: