user2146601
user2146601

Reputation: 13

Ember.js - How to manually associate a View and a Route in RC1

I have a a Route and a View that don't follow naming conventions:

App.PostView = Ember.View.create({
  templateName: 'myTemplate'
});

App.SomeRoute = Ember.Route.extend({ .. });

Normally I would have PostRoute instead of SomeRoute, but in this case where the name convention is not followed, How do I indicate to SomeRoute that the associated View that should be rendered is PostView. I know you can set the this.render('myTemplate') inside SomeRoute, but I need to associated with the View not just with the Template.

Thanks!

Upvotes: 1

Views: 1533

Answers (1)

Bradley Priest
Bradley Priest

Reputation: 7458

Your attempt should actually work. Ember looks up the view using the passed value as well, are you sure this doesn't work properly?

App.PostView = Ember.View.create({
  templateName: 'myTemplate'
});

App.SomeRoute = Ember.Route.extend({ 
  renderTemplates: function(controller,model){
    this.render("post");
  }
});

Upvotes: 4

Related Questions