ionic framework - Angular 2 ES6 - Sending event from component -
i want send custom event component in es6, can listen in template <component (someevent)="somefunction()">
, cannot make happen.
@component's
properties ouputs
or events
breaking application. missing something?
this component declaration:
import {component, output} 'angular2/core'; @component({ selector: 'section-navigator-component', templateurl: 'build/components/section_navigator/section_navigator.html', inputs: [ 'resources', 'attr' ], outputs: [ 'someevent' ] }) export class sectionnavigatorcomponent { constructor() { } resourceclickhandler($event, resource) { } }
this should work in case:
import {component, output, eventemitter} 'angular2/core'; @component({ selector: 'section-navigator-component', templateurl: 'build/components/section_navigator/section_navigator.html', inputs: [ 'resources', 'attr' ], outputs: [ 'someevent' ] }) export class sectionnavigatorcomponent { constructor() { this.someevent = new eventemitter(); } resourceclickhandler($event, resource) { this.someevent.emit(somevalue); } }
Comments
Post a Comment