当我安装angular时,当我创建标题组件时,它会初始地显示默认的angular output.but,它会显示类似this..please的错误。
我尝试了stackoverflow提供的解决方案,但它不起作用
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-header',enter code here
templateUrl: `header.component.html
`,
styleUrls: []
})
export class HeaderComponent implements OnInit {
constructor() {}
ngOnInit() {}
}发布于 2019-02-15 14:04:40
如果找不到HTML文件的路径,可能会发生错误。在代码中更改此templateUrl
templateUrl: './header.component.html',并将您的组件添加到module.ts文件
declarations: [HeaderComponent]发布于 2019-02-15 14:06:02
提供相对路径而不是绝对路径。
就像您的html在同一个文件夹中一样。
templateUrl: `./header.component.html'而不是
templateUrl: `header.component.html`https://stackoverflow.com/questions/54703356
复制相似问题