Outputs
Outputs allow components to emit custom events. For example, if we have a component that displays a button and we want the parent component to be able to add an event handler for the click event of the child component, we can achieve this using outputs.
Here is an example of how to integrate outputs. Place this code above the App
component's code:
var SampleComponent10 = ng.core.Component({ selector: "sampleten", outputs: ["click"], template: "" }).Class({ constructor: function(){ this.click = new ng.core.EventEmitter(); setInterval(function(){ this.click.next({}); }.bind(this), 10000) } }) var SampleComponent11 = ng.core.Component({ selector: "sampleeleven", directives: [SampleComponent10], template: "<br><sampleten (click)='clicked($event)'></sampleten>{{value}}" }).Class({ constructor: function(){ this.value = 1; this.clicked = function(e){ this.value++; } } })
Replace the App
component's code with this...