我有一个路由器映射是这样的:组织烬模板文件夹
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部署应用程序的应用程序,我不知道这是否会改变一些东西... –