I am currently utilizing Angular 2 beta 6.
The custom event I created is not being captured
import {Component, OnInit, EventEmitter} from 'angular2/core';
import {NgForm} from 'angular2/common';
import {Output} from "angular2/core";
@Component({
template: '<form class="form-horizontal" (ngSubmit)="onSubmit()" #registrationForm="ngForm" style="color: #676767">
<button type="submit" >Send Event</button>
</form>'
})
export class registrationComponent {
@Output() logged: EventEmitter<any> = new EventEmitter();
onSubmit () {
console.log(Button clicked);
this.logged.emit(null); // Emits an event on clicking the button
}
}
In addition to that, I have added another component which listens for my event 'logged'.
import {Component} from 'angular2/core';
@Component({
selector: 'message-com',
template: '<div (logged)="getLoggedIn($event)">Hello<div>'
})
export class MessageComponent {
getLoggedIn() {
alert("Event received ");
}
}
Although I see "Button clicked" in my console, I am actually anticipating "Event received "