Angular 2 @Output parameters -
im trying pass parameters through @output fired function receive 'undefined'. can please show me way pass parameters through eventemitter of @output? example:
var childcmp = ng.core.component({ selector:'child-cmp', outputs: ['myevent'] }).class({ constructor: function(){ this.myevent = new ng.core.eventemitter(); this.myevent.emit(false); } }); var parentcmp = ng.core.component({ selector:'parent-cmp', template:'<child-cmp (myevent)="invoke()"'></child-cmp>', directives: [childcmp] }).class({ constructor:function(){}, invoke: function(flag){ // here flag undefined!! } });
you shoud use following value provided event:
<child-cmp (myevent)="invoke($event.value)"'></child-cmp>'
this way invoke
method of childcmp
receive parameter value provide when emitting myevent
custom event.
hope helps you, thierry
Comments
Post a Comment