我最近将我的项目从角9升级到了角10,现在在类中添加一个装饰器是必须的。我有一个没有装饰器的模型类。它也是一个TypeScript文件。
假设我有以下模型
export class Car {
model: string;
type: string;
year: string;
}现在,当我运行ng serve时,它会抛出类缺少一个装饰器。它不是一个组件,也不是一个指令。
具体错误如下:
NG2007: Class is using Angular features but is not decorated. Please add an explicit Angular decorator.
12 export class Car {
~~~~~~~它甚至抱怨我后来使用的类在我的一些组件中被扩展。每次都强迫我用装饰器。
我如何处理这个问题?
发布于 2020-07-15 20:02:11
https://stackoverflow.com/questions/62921594
复制相似问题