Let's assume that I've set everything up correctly. I have a model App.User
and I have a controller App.UsersIndexUserController
.
GOOD GOOD GOOD GOOD GOOD
The following view template ...
<script type="text/x-handlebars" data-template-name="users_index_template">
{{#each user in users}}
{{log user}}
{{#linkTo users.user user}}{{user.name}}{{/linkTo}}
{{/each}}
</script>
... this outputs the following in browser's console.log ...
<App.User:ember258> { created_at="2013-03-05T01:51:15Z", id=76 ... etc ... }
BAD BAD BAD BAD BAD
However, when using itemController
directive in my template, like so ...
<script type="text/x-handlebars" data-template-name="users_index_template">
{{#each user in users itemController="usersIndexUser"}}
{{log user}}
{{#linkTo users.user user}}{{user.name}}{{/linkTo}}
{{/each}}
</script>
... this outputs the following in browser's console.log ...
<App.UsersIndexUserController:ember253> { target=<Ember.ArrayController:ember245> ... etc ... }
I'm expecting {{log user}}
to return an instance of App.User
for both cases. But as you can see above, it returns an instance of App.UsersIndexUserController
when using itemController
directive, and returns and instance of App.User
when not using itemController
directive.
Should my App.UsersIndexUserController
explicitly return some object such that in both cases above, {{log user}}
will return App.User
?
App.UsersIndexUserController = Ember.ObjectController.extend({
});
I'm using Ember.js v1.0.0-rc1
// Version: v1.0.0-rc.1
// Last commit: 8b061b4 (2013-02-15 12:10:22 -0800)