I have created a component and trying to pass boolean value inside it as @input which will help me to show/hide a div. But it is giving me undefined. can anyone please point out what is wrong in this?
Index.html
<abc-comp x="1" y="64" [showviewmore]="true"></abc-comp>
abc-comp.ts
@Input() x = '';
@Input() y = '';
@Input() showviewmore : boolean;
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
@Input() x = '';
@Input() y = '';
@Input() showviewmore : boolean =false;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.