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

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -