Closed kevincaradant closed 8 years ago
I wasn't able to inject rx either with a similar setup. I wanted to use observeOnScope. Was on 1.1.3 tried 1.0.4, didn't work so I went back to watches.
oki that works now. Someone help me on the Angular Gitter.
It's because I don't have declare the call of my Service correctly .
Look at this little correction but that change everything because I didin't inject the rx library in my static function in the initial thread.
class RxjsService {
constructor(rx) {
this.rx = rx;
this.rxjsFactoryObserver = null;
this.rxjsFactory$ = new this.rx.Observable.create(observer => {
this.rxjsFactoryObserver = observer;
}).share();
this.data = {
users: [
{name: 'John Rambo', isVisible: true, age: 32},
{name: 'Pablo Picasso', isVisible: true, age: 64}
]
};
}
getUsers() {
this.rxjsFactoryObserver.next(this.data.users);
}
addUser() {
this.data.users.push({name: 'John Kennedy', isVisible: true, age: 87});
this.rxjsFactoryObserver.next(this.data.users);
}
}
function Factory(rx) {
'ngInject';
return new RxjsService(rx);
}
export default Factory;
I hope that will help you @ilazarte
Hi everyone,
i try to create an example with es6 syntax.
I meet a problem that i don't understand: ERROR:
This is my code:
And where i import files (index.js):
Any idea ? thank you ! :)