简体   繁体   English

角度错误:无法绑定到“x 属性”,因为它不是“x 元素”的已知属性,即使在将@Input 放入子组件之后也是如此

[英]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.

相关问题 Angular2 RC5:无法绑定到“属性 X”,因为它不是“子组件”的已知属性 - Angular2 RC5: Can't bind to 'Property X' since it isn't a known property of 'Child Component' 无法绑定到“属性 X”,因为它不是“子组件”的已知属性 - Can't bind to 'Property X' since it isn't a known property of 'Child Component' Angular 4.x - 无法绑定到&#39;ngModel&#39;,因为它不是&#39;input&#39;的已知属性 - Angular 4.x - Can't bind to 'ngModel' since it isn't a known property of 'input' 无法绑定到“x”,因为它不是“输入”Angular 2 的已知属性 - Can't bind to 'x' since it isn't a known property of 'input' Angular 2 无法绑定到“ x”,因为它不是“ x”的已知属性 - Can't bind to 'x' since it isn't a known property of 'x' 无法绑定到“x”,因为它不是“y”的已知属性 - Can't bind to 'x' since it isn't a known property of 'y' 无法绑定,因为它不是角度分量的已知属性 - Can't bind since it isn't a known property of angular component Angular2:无法绑定到“ ngPluralCase”,因为它不是“ x”的已知属性 - Angular2 : Can't bind to 'ngPluralCase' since it isn't a known property of 'x' angular2:无法绑定到“ x”,因为它不是“ y”的已知属性 - angular2: Can't bind to 'x' since it isn't a known property of 'y' 无法绑定到“属性”,因为它不是“组件”的已知属性 - Can't bind to 'property' since it isn't a known property of 'component'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM