Ember笔记

ember常用的方法(官方文档的翻译而已):

 

1.modelFor

在路由层级中,返回父路径路由解析的model,具体例子如下:

App.Router.map(function() {
    this.route('post', { path: '/post/:post_id' }, function() {
      this.route('comments', { resetNamespace: true });
    });
});

App.CommentsRoute = Ember.Route.extend({
    afterModel: function() {
      this.set('post', this.modelFor('post'));
    }
});


 

 

 

 

 

posted @ 2016-02-24 10:38  Map2024  阅读(142)  评论(0)    收藏  举报