Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.component.html
- ----------------------
- <button class='btn' (click)="showbtnContent('btn1');">btn1</btn>
- <button class='btn' (click)="showbtnContent('btn2');">btn2</btn>
- <app-child></app-child>
- app.component.ts
- -------------------
- showbtnContent(btn){
- if(btn === 'btn1'){
- thisbtnContent = true;
- }else{
- thisbtnContent = false;
- }
- }
- child.component.html
- -------------------
- <div *ngIf='thisbtnContent' id='btn1Content'>jjjjjjjjjjjjjjjjjj</div>
- <div *ngIf='!thisbtnContent id='btn2Content'>jjjjjjjjjjjjjjjjjj</div>
- child.component.ts
- ------------------------
- @Component({
- selector: 'app-child'
- });
- thisbtnContent = true;
Add Comment
Please, Sign In to add comment