Home > OS >  Pass Boolean value in a component call from index.html
Pass Boolean value in a component call from index.html

Time:06-10

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  *ngIf="showviewmore">
      //Some Content and tags
  </div>

CodePudding user response:

try

<abc-comp x="1" y="64" showviewmore="true"></abc-comp>
  • Related