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
Can't export default Router.map()
#9966
Comments
This should be really easy to PR, though I can't yet guarantee that we'd merge it. |
the result of map, is an instance of router.js router, not ember router. As such the solution today is: https://github.com/stefanpenner/ember-cli/blob/master/blueprints/app/files/app/router.js#L1-L11 This has to do with the original flexibility of this API design and how chaining off router.js vs ember router. |
@stefanpenner any reason not to wrap the map function in Ember.Router to return the Ember version? |
unsure, I suspect it is fine now. It will for sure be fine in 2.x. I recall there was a reason we couldn't do this around 1.0, but I can't remember exactly what it was. |
just go for it, its so small, leaking inner router is just confusing. |
We could put in a check for this, where would be the best place to put this check and what's the most robust way to check? I posted on StackOverflow so anyone that searches can find an answer there (https://stackoverflow.com/questions/27539484/ember-js-failed-to-create-an-instance-of-routermain/27539485#27539485) |
check? I think Router.map should just return |
I agree that it should return the instance of Ember.Router. I've got active work in this area that I am targeting for 1.11 so I can roll this into that effort... |
@rwjblue 👍 |
Will be fixed once #9994 is merged. |
#9994 is merged. Can this issue be closed? |
I searched issues for: Router map return "router:main" - and got no results.
Confirmed on canary here: http://emberjs.jsbin.com/niceculasu/3/
Use case:
Error:
Expected:
To be able to return the result from Router.map - that is, I expected it to return the Router instance. I think this would be a great API. I would assume Ember supports method chaining on any and every object, I'm (grumpily) curious what else doesn't have straightforward jQuery-like chaining
Disclosure: I actually discovered this error when using
ember-cli-coffees6
and documented it all here:https://github.com/devinrhode2/major-domo/issues/1The text was updated successfully, but these errors were encountered: