max*_*max 4 angular2-directives
如何将html模板添加到指令中?这是一个不起作用的示例代码:
从'@ angular/core'导入{Directive};
@Directive({
selector:'[master-side-bar]',
templateUrl:'master-side-bar.html'})导出类MasterSideBar {
constructor(){
Run Code Online (Sandbox Code Playgroud)console.log('Hello MasterSideBar Directive');}
}
我收到以下错误:
类型'{selector:string; templateUrl:string; }'不能赋值给'Directive'类型的参数.对象文字只能指定已知属性,'templateUrl'在类型'Directive'中不存在.