March 2017
Intermediate to advanced
821 pages
18h 21m
English
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}}" ...Read now
Unlock full access