Ember笔记

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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‘));
    }
});


 

 

 

 

 

以上是关于Ember笔记的主要内容,如果未能解决你的问题,请参考以下文章