报错 按照课程做迁移之后显示没有找到组件
来源:2-6 【组件封装】分离封装第一个组件

CapRust
2019-08-01
输入 ng serve
启动失败,显示
Date: 2019-08-01T11:33:09.441Z
Hash: 6cd8da39d9ec90757b85
Time: 5283ms
chunk {main} main.js, main.js.map (main) 1.88 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 119 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.5 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 327 kB [initial] [rendered]
ERROR in src/app/app.module.ts(5,40): error TS2307: Cannot find module './scrollable-tab/scrollable-tab.component'.
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.
在app.component.html
文件的<app-scrollable-tab>
标签显示
'app-scrollable-tab' is not a known element:
1. If 'app-scrollable-tab' is an Angular component, then verify that it is part of this module.
2. If 'app-scrollable-tab' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
写回答
2回答
-
按置顶问题同步 vs code 设置。这个改动是自动完成的
042020-01-08 -
CapRust
提问者
2019-08-01
解决了,在 app.module.ts 里面 变成
import { ScrollableTabComponent } from './components';
即可,但是想知道,为什么没有像视频里那样这里不修改就直接能成功启动呢?老师也没有先改这一步就启动成功了。
10
相似问题