[英]Pass Boolean value in a component call from index.html
I have created a component and trying to pass boolean value inside it as @input which will help me to show/hide a div.我创建了一个组件并尝试将其中的布尔值作为@input 传递,这将帮助我显示/隐藏一个 div。 But it is giving me undefined.但它给了我不确定的。 can anyone please point out what is wrong in this?谁能指出这有什么问题?
Index.html索引.html
<abc-comp x="1" y="64" [showviewmore]="true"></abc-comp>
abc-comp.ts abc-comp.ts
@Input() x = '';
@Input() y = '';
@Input() showviewmore : boolean;
abc-comp.html abc-comp.html
<div class="col-xs-4" *ngIf="showviewmore">
//Some Content and tags
</div>
try modified code below试试下面的修改代码
<abc-comp x="1" y="64" [showviewmore]="true"></abc-comp>
abc-comp.tstry abc-comp.tstry
@Input() x = '';
@Input() y = '';
@Input() showviewmore : boolean =false;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.