Get error in Angular 7 ./src/app/app.component.ts Module not found: Error: Can't resolve
Get error in Angular 7 ./src/app/app.component.ts Module not found: Error: Can't resolve
在新安装的Angular我改了
app.components.ts 这样的文件
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: `<h1>Some Information</h1>`,
})
export class AppComponent {
title = 'my-app';
}
但是编译后出现错误
ERROR in ./src/app/app.component.ts
Module not found: Error: Can't resolve
我的应用目录只包含两个文件app.component.ts和app.module.ts
问题出在哪里?
使用内联模板创建组件的正确方法是什么?
我在您的代码中看到的一个问题是在您提供实际模板时使用 templateUrl
所以不用 templateUrl
使用 template
在新安装的Angular我改了
app.components.ts 这样的文件
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: `<h1>Some Information</h1>`,
})
export class AppComponent {
title = 'my-app';
}
但是编译后出现错误
ERROR in ./src/app/app.component.ts Module not found: Error: Can't resolve
我的应用目录只包含两个文件app.component.ts和app.module.ts
问题出在哪里?
使用内联模板创建组件的正确方法是什么?
我在您的代码中看到的一个问题是在您提供实际模板时使用 templateUrl
所以不用 templateUrl
使用 template