[英]./src/app/component/header.component.ts Module not found: Error: Can't resolve './header.component.html
when i installed the angular it initailly shown me the default angular output.but when i created the header component ,its showimg the error like this..please can anyone resolve my pbm..?当我安装 angular 时,它 initailly 向我显示了默认的 angular 输出。但是当我创建标题组件时,它显示了这样的错误..请任何人都可以解决我的 pbm ..?
i tried the solutions which was given by stackoverflow,but its not working我尝试了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() {}
}
An Error occurs may be if the path for HTML file is not found.如果未找到 HTML 文件的路径,则可能会发生错误。 Change this templateUrl in your code
在您的代码中更改此 templateUrl
templateUrl: './header.component.html',
and add your component to module.ts file并将您的组件添加到 module.ts 文件
declarations: [HeaderComponent]
Provide relative path instead of absolute path.提供相对路径而不是绝对路径。
As in if your html is in the same folder就像你的 html 在同一个文件夹中一样
templateUrl: `./header.component.html'
instead of代替
templateUrl: `header.component.html`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.