1

How do i give the showProduct:boolean = false; value to the app-product html selector so it will be false at start?

showProduct:boolean = false;
<button (click)="showProduct=!showProduct">Show Product</button>
<div *ngIf="!showProduct">
    <app-product></app-product>    
</div>

2
  • 1
    Your code seems correct, try to check that the HTML of the app-product component is not empty Commented Nov 14, 2017 at 8:20
  • 1
    If you are trying to pass an agument to the child component you need to use binding input property angular.io/guide/… Commented Nov 14, 2017 at 8:30

1 Answer 1

3

I think you need <div *ngIf="showProduct">,

<button (click)="showProduct=!showProduct">Show Product</button>
<div *ngIf="showProduct">
    <app-product></app-product>    
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.