[英]javascript es5 Angular2 compontent templateurl relative path not working
在ts组件中,使用templateUrl,需要添加moduleId属性,但在javascript中不起作用。
@Component({
moduleId: module.id,
selector: 'my-dashboard',
templateUrl: 'dashboard.component.html',
styleUrls: [ 'dashboard.component.css' ]
})
如何将ts转换为javascript?
(function(app){
var DashboardComponent = function (){
};
DashboardComponent.annotations = [
new ng.core.Component({
selector:'my-dashboard',
template: '<h3>My Dashboard</h3>',
moduleId:module.id,
templateUrl:'dashboard.component.html'
}),
];
app.DashboardComponent = DashboardComponent;
})(window.app=window.app||{})
要将Typescript转换为javascript,您需要运行Typescript编译器或内部使用此编译器的众多工具之一。
我建议您遵循并构建QuickStart项目以获取想法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.