简体   繁体   English

在Angular 7中获取错误./src/app/app.component.ts找不到模块:错误:无法解析

[英]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.

相关问题 错误 in./src/app/app.component.ts 找不到模块:错误:无法解析 './app.component.css' - ERROR in ./src/app/app.component.ts Module not found: Error: Can't resolve './app.component.css' Angular 4错误-./src/main.ts中找不到错误:错误:无法解析&#39;./$$_gendir/app/app.app.module.ngfactory&#39; - Angular 4 error - ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' 错误:找不到模块:错误:无法解析 src/app/app.component.css?ngResource Angular - Error: Module not found: Error: Can't resolve src/app/app.component.css?ngResource Angular ./src/app/component/header.component.ts 模块未找到:错误:无法解析&#39;./header.component.html - ./src/app/component/header.component.ts Module not found: Error: Can't resolve './header.component.html ./src/app/svg.component.ts中的错误找不到模块:错误:无法解析&#39;./svg.component.svg&#39; - ERROR in ./src/app/svg.component.ts Module not found: Error: Can't resolve './svg.component.svg' 当广告在我的文件上添加代码,就像在视频上一样时,我得到错误“ ./src/app/app.module.ts找不到模块:错误:无法解析&#39;@ angular / http&#39;” - when ad add code on my file as it is on video i get error “./src/app/app.module.ts Module not found: Error: Can't resolve '@angular/http'” /~/src/app/app.component.ts (23:8) 图像中的错误未定义 - Error in /~/src/app/app.component.ts (23:8) images is not defined 我的 Angular 应用程序在 app.component.ts 文件中出现错误 - My Angular App Has An Error In app.component.ts File 找不到模块:错误:无法解析“/usr/src/app/src”中的“@angular/localize/init” - Module not found: Error: Can't resolve '@angular/localize/init' in '/usr/src/app/src' app.component.ts下Angular function错误 - Angular function error under app.component.ts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM