I am using react-router-redux and I can't get the ownProps to have params in a deeply nested, connected component. Or is it only the component described in a which get will the params?
So here is a little schema:
Route
|___ LeveOne
\__Some Dumb Component
\___ Another dumb component
\__ A Connected Component
it's in the A Connected Component that I'm trying to get the ownProps.params, but can't.
The version of react-router-redux is 4.0.0
Thank you!
Related
Currently my Ember-cli application calls my API in this way:
apiurl:3000/ingredients?name=something
apiurl:3000/ingredients?filter=som?limit=10
I'd like to make Ember query for:
apiurl:3000/ingredient/something
apiurl:3000/ingredients/som?limit=10
But I've two problems:
WARNING: Encountered "ingredients" in payload, but no model was found for model name "ingredient" (resolved model name using myapp#serializer:application:.modelNameFromPayloadKey("ingredients"))
I can't find a way to make Ember use URL segments instead of query parameters.
I think I'm missing something?
Have you looked into overriding your RESTAdapter's buildURL method?
http://emberjs.com/api/data/classes/DS.RESTAdapter.html#method_buildURL
As what you're trying to do appears to be quite specific you could use this method to override the building of these requests, while at the same time keeping the default Ember model/params implementation the same.
Since I've upgraded from 1.3.2 to 1.4.0 I've got many problems about the serialization of the link-to url.
In the previous version, for each link-to we pass in the serialize method but it's not the case anymore, Can someone tell me why and if there is another alternative?
Thank u
I've found the solution !
Actually my route looks like this :
this.route('projects', {
path: '/projects/:pageProjects/:colProjects/:ascProjects'
});
And my handlebar looks like this :
{{#link-to "projects"}}
{{trc "plural" "Signed"}} <span class="pull-right">{{count.approuvedCount}}</span>
{{/link-to}}
The fact is that sometime I needed to set a default model directly in the serialize method which is not a great solution and I know it.
Since the ember ugrade to 1.4.0, if we don't pass any model parameter into the link-to, it doesn't call the serialize method anymore :).
I have seen an answer to this question and was directed to the Ember API Docs for using the browser's history.pushState ability
Apparently I need to add this code to my router.js file
App.Router.reopen({
location: 'auto'
});
However, doing so breaks my app! It is a very simple app so far, since I am still only learning... so its basically just a default installation with only 4 templates, 4 routes. I am using Ember App Kit which, I noticed initializes the router slightly differently than the ember guides describes.
Is there something different I need to do? or is there something I am doing wrong in general?
Ok... I found the answer, for anyone who might run into this same issue.
Ember app kit seems to define the router in a variable just called Router, so I don't need to use the conventional naming requirements.
All that needs to be added to the router.js is this:
Router.reopen({
location: 'auto'
});
:D
I have a simple model that worked with ember-data but not sure how to get this to work with ember-model?
Acme.App = Ember.Model.extend(
post_screenshot_url: Ember.attr()
post_screenshot_url_thumb: (->
#get('post_screenshot_url') + '/?thumb=true'
).property('')
)
This used to work with ember-data but now this doesn't work with ember-model. Thoughts?
It's working for me with latest Ember and Ember Model, check this JSBin:
http://emberjs.jsbin.com/obeHimU/3/edit?html,js,output
PS: You probably should add "post_screenshot_url" to the properties call on "post_screenshot_url_thumb" so it gets correctly updated.
I have been trying to test my ember application for 2 days with no success. There are examples out there that use fixtures but I was wondering if you might have an example of test scripts where RESTAdapter was used. I have tried using Fixtures for testing as you can see in the fiddle here : http://jsfiddle.net/deewen/u68Mx/1/, but that is also not working for me(sorry I couldn't find proper expect.js file).
it("Check analyticsRuns controller", function () {
//var controller = AS.__container__.lookup('controller:analyticsRunsIndex');
//the returns null too even though I have that controller
visit('/analytics')
.then(function() {
expect(find('*')).to.not.be(undefined);
});
});
Any suggestions for resource or read that could guide me on this would be highly appreciated. Thanks.
In general you don't want your test to hit a live API endpoint because at that point you're not only testing your application code, you're also testing both the functionality of the API and the state of any data that may (or may not) already be stored in the API service.
The Ember Data tests setup fake AJAX responses, much like you'd do with something like webmock on the server side. Something like that is probably the way to go.
https://github.com/emberjs/data/blob/master/packages/ember-data/tests/integration/adapter/rest_adapter_test.js#L34-L55