Guest User

Untitled

a guest
Oct 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. app.component.html
  2. ----------------------
  3. <button class='btn' (click)="showbtnContent('btn1');">btn1</btn>
  4. <button class='btn' (click)="showbtnContent('btn2');">btn2</btn>
  5. <app-child></app-child>
  6.  
  7. app.component.ts
  8. -------------------
  9. showbtnContent(btn){
  10. if(btn === 'btn1'){
  11. thisbtnContent = true;
  12. }else{
  13. thisbtnContent = false;
  14.  
  15. }
  16. }
  17. child.component.html
  18. -------------------
  19. <div *ngIf='thisbtnContent' id='btn1Content'>jjjjjjjjjjjjjjjjjj</div>
  20. <div *ngIf='!thisbtnContent id='btn2Content'>jjjjjjjjjjjjjjjjjj</div>
  21.  
  22. child.component.ts
  23. ------------------------
  24. @Component({
  25. selector: 'app-child'
  26. });
  27. thisbtnContent = true;
Add Comment
Please, Sign In to add comment