Fhernd icon

club.component.ts

Fhernd | PRO | 12/18/16 02:08:17 PM UTC | 0 ⭐ | 6377 👁️ | Never ⏰ | []
TypoScript |

800 B

|

None

|

0 👍

/

0 👎

import { Component, EventEmitter } from '@angular/core';
 
@Component({
    selector: 'single-component', 
    outputs: ['putRingOnIt'],
    template: `
        <button (click)="liked()">Like it?</button>
    `
})
export class SingleComponent{
    putRingOnIt: EventEmitter<string>;
 
    constructor() {
        this.putRingOnIt = new EventEmitter();
    }
 
    liked() : void {
        this.putRingOnIt.emit("ok ok ok");
    }
}
 
@Component({
    selector: 'club', 
    template: `
        <div>
            <single-component 
                (putRingOnIt) = "ringWasPlaced($event)"
            >
            </single-component>
        </div>
    `
})
export class ClubComponent{
    ringWasPlaced(message: string) : void {
        console.log(`Put your hands up: ${message}`);
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎