Looks like we've got a problem with EventEmitters now. Either that or I'm missing something.
Here is the plnkr with the situation: http://plnkr.co/edit/9w5nzAuMkE1BHoTo2GxN?p=preview
Basically, we can't return an observable anymore when using toRx() see the change here.
We can return an observable with _subject, though. But it just doesn't feel right.
Does anyone have any word on it? Should I still be using EventEmitter for that kind of situation or just switch to Rx's Observables?
Here's the full code:
import {Component, View, EventEmitter, OnInit, bootstrap} from 'angular2/angular2';
class SomethingService {
_ee: EventEmitter = new EventEmitter();
fireStuff() {
setTimeout(() => {
this._ee.next('fire!');
}, 1000);
//return this._ee.toRx(); - doesn't work anymore
return this._ee._subject; // silly work around
}
}
@Component({
selector: 'hello',
viewBindings: [SomethingService]
})
@View({
template: `
<h3>hello - uncomment line 11 and comment line 12 to see the error</h3>
<button type="button"
(click)="fire()">btn</button>
<pre [text-content]="f"></pre>
`
})
export class Hello implements OnInit {
f: string;
constructor(private _ss: SomethingService) {
}
onInit() {
console.log('hello init');
}
fire() {
this.f = "loading";
this._ss
.fireStuff()
.subscribe((info) => {
this.f = info;
});
}
}
bootstrap(Hello);
Old issue: #3580
cc: @ericmartinezr @robwormald @pkozlowski-opensource
Looks like we've got a problem with EventEmitters now. Either that or I'm missing something.
Here is the plnkr with the situation: http://plnkr.co/edit/9w5nzAuMkE1BHoTo2GxN?p=preview
Basically, we can't return an observable anymore when using
toRx()see the change here.We can return an observable with
_subject, though. But it just doesn't feel right.Does anyone have any word on it? Should I still be using EventEmitter for that kind of situation or just switch to Rx's Observables?
Here's the full code:
Old issue: #3580
cc: @ericmartinezr @robwormald @pkozlowski-opensource