javascript - 使用管道时出现属性绑定错误
问题描述
我正在关注本教程
https://ultimatecourses.com/blog/angular-pipes-custom-pipes
我正在尝试使下面发布的代码正常工作。当我调用命令时
ng servr --open
我收到以下错误:
Error occurs in the template of component Appcomponent
ptoperty file does not exist on type Appcomponent
请让我知道为什么我会收到此错误以及如何解决它
app.component.ts:
import { Component } from '@angular/core'
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
file = { name: 'logo.svg', size: 2120109, type: 'image/svg' };
}
app.component.html:
{{文件名}}
{{文件大小 | 文件大小}}
解决方案
你在 import import { Component } from '@angulat/core' 中有拼写错误
改成
从“@angular/core”导入{组件}
推荐阅读
- python - 在 Python 中建立 HTTPS 连接时出现 HTTP 400 错误请求?
- symfony4 - 如何在 Doctrine 查询生成器中使用函数
- python - 将一个巨大的列表拆分为更小的列表并将项目附加到这些子列表中
- java - 如果用户输入了地址,则仅显示地址格式信息
- html - Carousel Bootstrap 不能用作幻灯片
- java - 将 Java Spark Sql 连接到 Mysql
- amazon-web-services - 你能指导我有关专用 AWS 的信息吗?
- python - 让 dev_appserver.py 监听变化
- python-3.x - python中列表理解输出的问题
- ubuntu - udev 规则问题 - 在 ubuntu 20.04 上安装 STMicroelectronics STlink 工具