any solution for this problem ..?
On Thu, Oct 5, 2017 at 1:27 PM, Vinu Prasad <[email protected]> wrote: > Hi Sander , > > Thanks for the response . But it will not work for me. There is nothing to > dispaly > > On Thu, Oct 5, 2017 at 11:20 AM, Sander Elias <[email protected]> > wrote: > >> Hi Vinu, >> >> You should switch to Httplient instead of using http. Aside from that, >> this is straight from the docs <https://angular.io/api/http/Http#post>: >> >> post(url: string, body: any, options?: RequestOptionsArgs >>> <https://angular.io/api/http/RequestOptionsArgs>): Observable<Response >>> <https://angular.io/api/http/Response>> >>> >> >> So the complete payload you want to post is in the second parameter, and >> the thirth parameter is the options of the post . >> Also, it cleary states that it returns an observabe. As that is an >> object, your alert is right with [Object Object], as that is what it is. >> Do read something about how to deal with asynchrone requests. >> >> for now try something llike this: >> >> this._http.post("http://192.168.0.102:8000/user.lua",{uname,pass}) >> >> .map(result => result.json()) >> >> .catch(error => {console.error(error); return Observable.empty()} >> .subscribe(data => console.log('result',data) >> >> >> As a rule of thumb, you should have a maxium of 1 subscribe calls in your >> component, but that's for later on. >> >> Hope this helps you a bit, >> Regards >> Sander >> >> >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Angular and AngularJS discussion" group. >> To unsubscribe from this topic, visit https://groups.google.com/d/to >> pic/angular/YYLw58JKolo/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > *Vinu Prasad* > > -- *Vinu Prasad* -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
