报错 按照课程做迁移之后显示没有找到组件

来源: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回答

接灰的电子产品

2019-08-01

按置顶问题同步 vs code 设置。这个改动是自动完成的

0
4
小嘿哟
回复
接灰的电子产品
老师,我的也是这里报错,但我没看懂这是什么意思,可以帮忙再解释下吗?
2020-01-08
共4条回复

CapRust

提问者

2019-08-01

解决了,在 app.module.ts 里面 变成 

import { ScrollableTabComponent } from './components';

即可,但是想知道,为什么没有像视频里那样这里不修改就直接能成功启动呢?老师也没有先改这一步就启动成功了。

1
0

Angular 开发拼多多webapp 从基础到项目实战

高仿拼多多WebApp,带你在实战环境中学习Angular

1317 学习 · 451 问题

查看课程