[英]Get error in Angular 7 ./src/app/app.component.ts Module not found: Error: Can't resolve
In new installed Angular I changed 在新安装的Angular中,我进行了更改
app.components.ts file like this 像这样的app.components.ts文件
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: `<h1>Some Information</h1>`,
})
export class AppComponent {
title = 'my-app';
}
But after compiling I am getting error 但是编译后出现错误
ERROR in ./src/app/app.component.ts Module not found: Error: Can't resolve ./src/app/app.component.ts中的错误找不到模块:错误:无法解析
My app directory contains only two files app.component.ts and app.module.ts 我的应用程序目录仅包含两个文件app.component.ts和app.module.ts
Where is the problem ? 问题出在哪儿 ?
What is a right way to create component with inline template ? 用内联模板创建组件的正确方法是什么?
我在您的代码中看到的一个问题是,在您提供实际模板时正在使用templateUrl
,因此代替templateUrl
使用template
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.