1
如何訪問子模板中的數據?將數據傳遞給子模板
例如,她是我的路由器:
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,但這仍然不清楚。
有道理。謝謝。 – user1168427 2013-03-15 00:43:03