如何从子模板访问数据?
例如,她是我的路由器:
App.Router.map(function() {
this.resource("users", function(){
this.route('new');
});
this.resource("user", {path: '/users/:user_id'}, function(){
this.route('edit');
});
});
路线:
App.UsersIndexRoute = Ember.Route.extend({
model: function() {
return App.User.find();
}
});
单用户模板:
<script type="text/x-handlebars" data-template-name="user">
<h2>{{name_full}} is the username on the resource template</h2>
{{ outlet }}
</script>
单用户索引模板:
<script type="text/x-handlebars" data-template-name="user/index">
<h2>{{name_full}} is the username on the index page.</h2>
{{#linkTo users}}Back to All Users{{/linkTo}}
</script>
我了解单用户模板如何访问用户对象,但是如何授予子路由访问权限?
我已经访问了Ember Router Guides,但这对我来说仍然不清楚。