2
我正在編寫一個組件,我需要訪問當前路由的模型; 在組件的模板,我想這樣做:在Ember組件中獲取當前路由的模型
{{#each color in model}}
...
{{/each}}
我會在不同的路由使用這個組件,不同型號
我如何可以訪問組件內的電流路徑的模式?
Ember.Component.extend({
didInsertElement: function() {
console.log(this.get('controller') //this is not the route's controller
console.log(this.get('controller').get('model')); //undefined of course
}
});
太簡單了!謝謝 – 2014-10-04 21:03:51