请确保你在使用input装饰器时,已经正确引入了@Input装饰器,并按照正确的语法使用。示例代码如下:
import { Component, Input } from '@angular/core';
@Component({
selector: 'my-component',
template: `
{{myValue}}
`
})
export class MyComponent {
@Input() myValue: string;
}
在这个示例代码中,我们在MyComponent类中使用了@Input装饰器来获取父组件中传递的值。确保你在使用@Input装饰器时,遵循着类似的语法。