angular - 类型“ArtistDetailsComponent”上不存在属性“艺术家”。类型“ArtistDetailsComponent”
问题描述
我无法构建我的应用程序。当我使用“ng serve”时,一切正常,但“ng build”失败并出现错误:
类型“ArtistDetailsComponent”上不存在属性“艺术家”。
<div class="container mt-3">
<div class="row justify-content-center">
<div class="col-sm-4 col-lg-3">
<img class="img-fluid rounded" src="'./assets/images/' + artist.shortname + '.jpg'" alt="{{artist.name}} photo">
</div>
<div class="col-sm-8 col-lg-4">
<h2 class="mt-3 mt-sm-0 mb-0">{{artist.name}}</h2>
<h4 class="mt-0">{{artist.reknown}}</h4>
<p>{{artist.bio}}</p>
</div>
</div>
</div>
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-artist-details',
templateUrl: './artist-details.component.html',
inputs: ['artist']
})
export class ArtistDetailsComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
我该如何解决?更多代码在这里:代码
解决方案
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-artist-details',
templateUrl: './artist-details.component.html'
})
export class ArtistDetailsComponent implements OnInit {
// If the Artiste type exists and don't forget to import it
@Input() artiste: Artiste;
constructor() { }
ngOnInit() {}
}
推荐阅读
- javascript - 如何让轮子在服务器端转动
- mysql - 从 Google 应用脚本执行 MySQL 存储过程
- java - 家庭作业:使用 RNG 将英尺转换为英寸
- kubernetes - kubernetes, pods 不能通过域名通信
- wrapper - Weka 中的顺序前向选择
- google-sheets - 将多列中的相同条件相加得到总数
- c - 在评估三角函数时,如何让 C 区分单浮点数和双浮点数?
- c# - 如何在 C# 中解决此问题: main.cs(18,5): 警告 CS0642: 可能错误的空语句
- python - 嵌套字典的自动激活,其中包含要在 Python 中附加的列表
- websphere - 在哪里可以找到 com.ibm.websphere.runtime.CustomService 现有服务的配置详细信息?