Typescript 样式URL路径取决于全局变量或服务

Typescript 样式URL路径取决于全局变量或服务,typescript,angular,Typescript,Angular,我需要在styleUrls/templateUrl字段中插入一个变量路径,因为出于部署目的,既不能使用固定的绝对路径,也不能使用固定的相对路径来派生此路径 var cssPath = "/foo/bar/css/"; var tmplPath = "/foo/bar/tmpl/"; @Component({ selector: 'mycomp', styleUrls: [ cssPath + 'mycomp.css' ], templateUrl: tmplPath

我需要在styleUrls/templateUrl字段中插入一个变量路径,因为出于部署目的,既不能使用固定的绝对路径,也不能使用固定的相对路径来派生此路径

var cssPath = "/foo/bar/css/";
var tmplPath = "/foo/bar/tmpl/";

@Component({
    selector: 'mycomp',
    styleUrls: [  cssPath + 'mycomp.css' ],
    templateUrl: tmplPath + 'mycomp.html'
})
class MyComponent {
}
我开始玩一个游戏