我有一個路由器映射是這樣的:組織燼模板文件夾
this.resource('eng', function(){
this.route('home');
this.resource('eng.rent', {path: 'rent' }, function(){
this.route('boulderSmall', {path: 'boulder-small'});
this.route('boulderXl', {path: 'boulder-xl'});
});
});
文件存儲在「模板/工程」文件夾中的模板;對於「home」和「eng.rent」路由,一切正常:Ember可以自己找到模板文件所在的位置;但對於其他路線我必須指定的模板,如:
Importclimbing.EngRentBoulderSmallRoute = Importclimbing.StdEngRoute.extend({
renderTemplate: function() {
this.render('eng/boulderSmall');
}
});
有人能解釋灰燼如何查找模板文件?例如,如果我沒有像上面那樣爲EngRentBoulderSmallRoute指定「renderTemplate」,那麼該模板將不會呈現(即使我將「boulderSmall.hbs」文件放入「template」文件夾而不是「template/eng」;因此,如果我想將「boulderSmall.hbs」存儲到「templates/eng/rent」文件夾中,應該將哪個路徑傳遞給renderTemplate函數?
不幸的是它不工作;如果我將「reng.hbs」重命名爲「eng.rent.hbs」並將其放入「模板」文件夾中,則它不會呈現(可以將它保存到templates/eng文件夾中並簡單地命名爲「rent.hbs」) ;如果我把hbs文件放到eng.rent子文件夾中,它們不會呈現... –
我剛更新了應該爲你工作的答案。乾杯 – kiwiupover
不,還不行;這是我所做的第一次嘗試之一(除了我已經在camelcase中命名了所有.hbs文件,例如boulderSmall.hbs);我使用yeoman部署應用程序的應用程序,我不知道這是否會改變一些東西... –