Angular 2 中 templateUrl 的基本路径
base path for templateUrl in Angular 2
我只需要在 templateURL 中放置一个自定义路径
@Component({
selector: 'hero-detail',
templateUrl: BASE_TEMPLATE_PATH + 'hero-detail.component.html',
styleUrls: ['hero-detail.component.css']
})
我尝试了很多post
中指出的事情
但是没有人为我工作,尝试了很多次从那个罐子里实现一些东西但没有成功,而且 post 没有足够的信息把变量放在哪里,你们能给点提示吗?
我的想法你能不能在index.html中有基本路径输入隐藏字段,比如
<input type="hidden" id="hdnTemplate" value="http://example.com/app/modules/templates" />
@Component({
selector: 'hero-detail',
templateUrl: function() { return $('#hdnTemplate').val()+'/hero.detail.component.html'}()
})
我只需要在 templateURL 中放置一个自定义路径
@Component({
selector: 'hero-detail',
templateUrl: BASE_TEMPLATE_PATH + 'hero-detail.component.html',
styleUrls: ['hero-detail.component.css']
})
我尝试了很多post
中指出的事情但是没有人为我工作,尝试了很多次从那个罐子里实现一些东西但没有成功,而且 post 没有足够的信息把变量放在哪里,你们能给点提示吗?
我的想法你能不能在index.html中有基本路径输入隐藏字段,比如
<input type="hidden" id="hdnTemplate" value="http://example.com/app/modules/templates" />
@Component({
selector: 'hero-detail',
templateUrl: function() { return $('#hdnTemplate').val()+'/hero.detail.component.html'}()
})