Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 12:55
    vella-nicholas commented #43876
  • 12:52
    petebacondarwin commented #43876
  • 12:34
    ngbot[bot] milestoned #43889
  • 12:34
    sonukapoor labeled #43889
  • 12:34
    sonukapoor labeled #43889
  • 12:30
    vella-nicholas commented #43876
  • 11:42
    petebacondarwin commented #43887
  • 11:40
    ngbot[bot] milestoned #43887
  • 11:40
    ngbot[bot] milestoned #43887
  • 11:40
    petebacondarwin labeled #43887
  • 11:40
    petebacondarwin labeled #43887
  • 11:40
    petebacondarwin labeled #43887
  • 11:40
    petebacondarwin labeled #43887
  • 11:38
    willydee commented #43888
  • 11:36
    petebacondarwin commented #43888
  • 11:35
    petebacondarwin commented #43875
  • 11:28
    willydee commented #43888
  • 11:25
    petebacondarwin commented #43876
  • 11:23
    petebacondarwin closed #43888
Aleš
@fxck
why would anyone want a promise?
but if you really really wanted a promise, you could probably just do Observable.toPromise()
(not sure if that's ported to rxjs5)
Aliaksandr Astashenkau
@dfsq
well, I guess many people (including me) a little confused with new approaches with observables, so I can understand that someone would want to continue to consume good old promises
Aleš
@fxck
believe me, you don't.. the only difference between a promise and an observable, when it comes to a simple Http request
is that you do .subscribe() instead of .then()
Soroush Gholamzadeh
@s-o-r-o-u-s-h
@dfsq I also should say that Observables have very useful methods that implementing them with a promise would be a hard task, like retry()
Aliaksandr Astashenkau
@dfsq
i know all that, just saying that some people are going to be confused anyway
Aleš
@fxck
read this angular/angular#5876
Aliaksandr Astashenkau
@dfsq

but if you really really wanted a promise, you could probably just do Observable.toPromise()
(not sure if that's ported to rxjs5)

I was able to do it with PromiseObservable.create(promise); with

import {PromiseObservable} from 'rxjs/observable/fromPromise';
Aleš
@fxck
I don't understand what confuses people about observables/rxjs.. or well, I absolutely do, reactive programming is mind bending and rxjs has like 50 million operators.. but in the most simple use case, that is a simple http get request, it's all the same, just different callback function, subscribe instead of then..
Aliaksandr Astashenkau
@dfsq
For simple cases the difference is not significant. But I wonder (because I don't know the subject yet that well) how well Observables work for situations that have been a breeze for Promises: like promise chaining, error handling. Thanks for the link, btw.
Aleš
@fxck
everything promises could do, observables can as well + more.. it's all pretty well explained in that issue
also let me find one talk
https://www.youtube.com/watch?v=UHI0AzD_WfY and this, both worth watching
Aliaksandr Astashenkau
@dfsq
Thank, this is what I need - to learn more about observables.
Rob Wormald
@robwormald
One reason that http is observable, among others, is that fetch exists
There's simply no reason for us to entirely reimplement it
Aleš
@fxck
fetch is nice and stuff, but seriously, when you are getting into angular2, you might as well embrace the new age completely, and observables are the new age, if you plan on actually using angular2, there's no getting away from this, things like reactive programming, redux, imports, modules, bundlers are gonna be all around you.. the sooner you learn to use them, the better
Eric Martinez
@ericmartinezr
"plnkr addict"... addictions are bad...
Didn't watch that video before, will watch it now
Aleš
@fxck
which one
that hangout?
Eric Martinez
@ericmartinezr
yep
Aleš
@fxck
nothing new there if you've seen all the other videos : ) it's basically introduction into observables
Eric Martinez
@ericmartinezr
It's always useful to be remembered of everything you've seen before :P
Aleš
@fxck
fortunately, @robwormald is working on 60 part egghead series about reactive programming, rxjs, redux and angular2, it's gonna be all we've ever dreamt of, no more stupid counter/todo examples everyone has seen thousand times! : )
Eric Martinez
@ericmartinezr
He totally should make a backup of everything he has answered in this chatroom
Soroush Gholamzadeh
@s-o-r-o-u-s-h
@ericmartinezr Hi,could you pls check your private messages?
jeff
@jjarrell50
@robwormald - (currenttime-changed), indeed simpler and more angular2 idiomatic. Thank you.
Eric Martinez
@ericmartinezr
@s-o-r-o-u-s-h that's a question that you should ask here, not in private :P. You'll have more chances to have a good answer
Ville Vainio
@vivainio
Rx needs less tutorials and "mind blowing stuff"
Rob Wormald
@robwormald
?
Soroush Gholamzadeh
@s-o-r-o-u-s-h
@ericmartinezr But it was your approach specifically ;-)
The only thing that I need is a code example
Eric Martinez
@ericmartinezr

@s-o-r-o-u-s-h this is my approach

this._replay = new ReplaySubject(1);
http.get('URL').subscribe(this._replay);
get replay()  {
   return this._replay;
}

That would be inside the service, then from the components I do service.replay.subscribe(res => /* do something with result */)

That works for me, is it the best approach? I don't know, that's why you should ask here :P
Soroush Gholamzadeh
@s-o-r-o-u-s-h
Thank you :+1:
Eric Martinez
@ericmartinezr
:+1:
Ville Vainio
@vivainio
Meaning: Observables should be treated more "this is how callbacks work now" (like promises before that), not "reactive programming revolution is here and no codebase is safe" (as that can be intimidating)
Daniel
@gaiottino
Is it no longer possible to use a regular link-tag to call a route without reloading the page?
The <a [routerLink] syntax is often very combersome
Aleš
@fxck
@gaiottino there might be a new syntax
comming soon...ish
Daniel
@gaiottino
Ah. Cool. Thanks
James Pacileo
@jamespacileo
@robwormald > this is where the webworker integration is nice, if you're doing something realllly heavy
Thanks for the suggestion!
Eric Martinez
@ericmartinezr
@robwormald :point_up: 28 de Diciembre de 2015 10:48 in the hangout talk at 27:40 you talk about Observables cleaning up themselves, is that always the case? Is it necessary to us to unsubscribe in ngOnDestroy for example, as a good practice?
Eric Martinez
@ericmartinezr
@robwormald for example in AsyncPipe you handle the unsubscription manually (maybe because it supports Promises too?)