Reputation: 17803
I'm pretty new to Ember.js and while developing an app I just found out about the new router API. which was merged and has no documentation at all (except for this - https://gist.github.com/3981133)
I have no idea about how to even start converting my app to the new router API. this "walkthrough" doesn't help much.
1) how do I connect templates to named outlets, for example {{outlet main}} ?
2) I use App.router.someController and App.router.get('store').findAll() and .find() all over, what should those be replaced with ?
3) is there any change to the handlebars tag in html <script type="text/x-handlebars" data-template-name="templateName">
?
that all I can think for now..
Upvotes: 4
Views: 957
Reputation: 27399
I just finished this upgrade myself on a small example project
https://github.com/toranb/ember-code-camp
To answer a few of your questions directly
1) no more connectOutlets noise - just map a route to an ember route class/object. this approach is very convention based btw (template/view/controller/route all match)
CodeCamp.Router.map(function(match) {
match("/").to("sessions");
match("/session/:session_id").to("session"); //no route needed -ember will apply the context for you
match("/speaker/:speaker_id").to("speaker"); //same as above so long as my handlebars template name matches (speaker for this route)
});
CodeCamp.SessionsRoute = Ember.Route.extend({
setupControllers: function(controller) {
controller.set('content', CodeCamp.Session.find());
}
});
2 a) you get the store in the router like so
App.YourObject.find()
2 b) you can commit the store from within your controller like so
this.get('store').commit()
3) my handlebars stuff was unchanged with the exception of route related helpers
I remove action helpers defined with <a {{action and used linkTo instead
{{#linkTo 'session' session}}View Session Details{{/linkTo}}
Upvotes: 5