Angular 4 (click) changes the class of element on another component

Discussão em 'Angular' iniciado por Naturo Power, Outubro 29, 2024.

  1. Naturo Power

    Naturo Power Guest

    I have one root component. One root component has 3 child component:

    In PressComponent I have a button with (click)="changeColors())".

    In CalcComponent I have a box with blue background.

    In PianoComponent I have a box with red background.


    How can I do this:

    When I click on button in PressComponent then:

    In CalcComponent box will get the class .calc-box-green.

    In PianoComponent box will get the class .piano-box-yellow.

    Plunker example

    Continue reading...

Compartilhe esta Página