Create/Assign controller while creating view

var view = Ember.View.extend({

 templateName: 'some',
//action: 'save',
//click: function () { this.triggerAction(); },
init: function () {
this.set('controller', App.SomeController.create())


Here i am creating the view and appending to a div, however here i have to explicity set the controller this.set('controller', App.SomeController.create())

Is it possible to implicitly assign the controller while creating view?


You can try to use ‘render’ helper in your template for rendering a view. In this case a controller will be implicitly assigned to a view.


{{render}} or you can you can inject a view and assign it controller in an outlet by using the renderTemplate hook on the route.

If it’s an array, you can use the each handlebars helper like: {{#each contentArray itemController='someController'}}..{{/each}}