[英]Angular error: Can't bind to 'x property' since it isn't a known property of 'x element' , even after putting @Input in child component
I have used an @Input decorator in a component to receive data from another component.我在一个组件中使用了 @Input 装饰器来接收来自另一个组件的数据。
childComponent.ts- @Input() isShown: boolean;
childComponent.ts-@Input
@Input() isShown: boolean;
parentComponent.html- <tab [isShown]="form.get('tab').value === View.Account" [label]="Tab Name" ></tab>
parentComponent.html-
<tab [isShown]="form.get('tab').value === View.Account" [label]="Tab Name" ></tab>
I am getting this error on compilation-- error: Can't bind to 'isShown' since it isn't a known property of 'tab'我在编译时收到此错误 - 错误:无法绑定到“isShown”,因为它不是“标签”的已知属性
What can I do to fix this?我能做些什么来解决这个问题?
Looking at the above comments and see that "tab" selector being a selector for a custom library, not your child component, it doesn't make any sense of having an @Input
on your child, but you use it to another component.查看上面的评论并看到“选项卡”选择器是自定义库的选择器,而不是您的子组件,在您的子组件上使用
@Input
没有任何意义,但您将它用于另一个组件。 The isShown
should be used with the child selector. isShown
应该与子选择器一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.