Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:28
    google-cla[bot] labeled #44378
  • 08:28
    crisbeto opened #44378
  • 07:27
    anthonygedeon starred angular/angular
  • 06:09
    AVu120 starred angular/angular
  • 05:36
    Judecx14 starred angular/angular
  • 03:21
    roman-komarov starred angular/angular
  • 01:09
  • Dec 04 23:10
    Lukc4 starred angular/angular
  • Dec 04 23:03
    AlexandreVerhoye starred angular/angular
  • Dec 04 23:02
    thammapat starred angular/angular
  • Dec 04 22:55
    XitusDev starred angular/angular
  • Dec 04 22:26
    dario-piotrowicz commented #30940
  • Dec 04 22:24
    dario-piotrowicz commented #34367
  • Dec 04 22:18
    dario-piotrowicz commented #35030
  • Dec 04 22:18
    dario-piotrowicz commented #35030
  • Dec 04 21:59
    dario-piotrowicz commented #42946
  • Dec 04 21:40
    dario-piotrowicz commented #42125
  • Dec 04 21:40
    dario-piotrowicz commented #42125
  • Dec 04 21:39
    dario-piotrowicz commented #42125
  • Dec 04 21:38
    dario-piotrowicz commented #42125
pantonis
@pantonis
Im a newbie in angular2
any tutorial on asp.net and angular2?
Aleš
@fxck
if you are a newbie, then learn angular2 basics first
what backend you use after that is entirely up to you
Rob Wormald
@robwormald
@fxck ""look, http returns an observable, so the best thing you can do, obviously, is to wrap that in a promise, and manually handle resolve and reject"
where is that happening?
Aleš
@fxck
I'm probably exaggerating, but there is something similar happening, let me find it..
dunno, either can't find it(wrapping http in a promise), or it was changed already, http://stackoverflow.com/questions/34455531/angular-2-object-works-object-child-throws-error?noredirect=1#comment56653446_34455531 here's the confusion though

that guy is doing this

  getProfileData(username:string):any {
    return new Promise((resolve, reject) => {
      this._authHttp.get(API_PREFIX + '/users/username/' + username)
        .map(res => res.json())
        .subscribe(
          data => {
            resolve(data.data);
          },
          err => {
            reject(err);
          }
        )
      ;
    });

simple because he saw promises being used in the tutorial

Vlado Tesanovic
@vladotesanovic
What is the best way to detect when @Input('something') get value?
JavascriptMick
@JavascriptMick
I thought the tutorial was decent in general though and the carry on sections for dependency injection and user input were also good
Aliaksandr Astashenkau
@dfsq
@fxck so you mean it is better to return observable anyway instead of promise object?
Aleš
@fxck
this would be the way to do it
  getProfileData(username:string):any {
      this._authHttp.get(API_PREFIX + '/users/username/' + username).map(res => res.json());
  };
don't need anything else
Aliaksandr Astashenkau
@dfsq
this will return observable. but if someone wants a promise
Aleš
@fxck
the question is
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"