ngUpgraders / ng-forward

The default solution for those that want to write Angular 2.x style code in Angular 1.x
411 stars 36 forks source link

$event object is not correct payload #88

Closed daniele-zurico closed 8 years ago

daniele-zurico commented 8 years ago

Hi all I take a look on other issues that you have but I haven't found a reply to my question (the only one that seems very similar is #46 but seems that they use old implementation).

I've a component:


Html:
(click)="tlc.selectItem(node);

Js:

@Output('onSelectedItem')
onSelectedItem = new EventEmitter();

selectItem(node) {
        this.onSelectedItem.onNext(node);
    }

In my parent component I do:

html:
(on-selected-item)="tree.onSelectedItem($event)"

Js:
onSelectedItem(evt){
        console.log(evt);
    }

The problem is that node is inside CustomEvent. So to access to my data I've to do something like:

evt.originalEvent.<myData>

Is something wrong? I expect that I can do

evt.<myData>

thanks a lot

timkindberg commented 8 years ago

Can you do evt.detail?

daniele-zurico commented 8 years ago

there isn't a 'detail' property. If I try to do like suggested in the issue #46 I receive undefined

eXaminator commented 8 years ago

Shouldn't the $event object be whatever was passed to the next() call? As explained here? I can't find anything about a detail key there.