Angular 4/5 HTTP GET and POST requests tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ย. 2024
  • Angular 5 fetching data using HTTP GET and Saving data using HTTP POST requests. Also fix CORS by setting allow-control-allow-origin using http interceptor.
    Git Repo of this project
    * github.com/tec...
    Article and code samples from this tutorial
    * techsith.com\
    Please be my patreons on patreaon
    * / techsith
    Follow me for technology updates
    * / techsith
    * / techsith1
    Help me translate this video.
    * www.youtube.com...

ความคิดเห็น • 343

  • @architadesai7876
    @architadesai7876 6 ปีที่แล้ว +5

    There was a time when I had no hope to finish my task on the edge and then your video came and you're such a savior!
    No other videos explained it like this.

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว +1

      Archita, I am glad that you were able to fine what you were looking for. :)

    • @iily.official
      @iily.official 5 ปีที่แล้ว

      @@Techsithtube it's sad that you didn't do the Post request example into the input area :(

  • @ericaepperson8928
    @ericaepperson8928 6 ปีที่แล้ว +3

    thank you for your down-to-earth teaching style. So nice to listen to you chat about coding without the inflated ego that so many people in the tech world seem to think is requisite to being a successful programmer. I really enjoy your videos, thank you!

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว +1

      Thank you for watching. I believe that as a teacher you need to be humble.

  • @mukeshvaidya1379
    @mukeshvaidya1379 6 ปีที่แล้ว +1

    you have very pleasing way to present the topic in simple and lucid manner which made me comment .Looking forward for more in Angular God Bless!

  • @somesbhowmick2082
    @somesbhowmick2082 6 ปีที่แล้ว +3

    Great component and as expected, full of necessary materiel related to "HttpService and CORS". You make complex thing simple and represented it nicely, Thanks

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว +1

      Somes, I am glad that it helped. I went through lot of trouble understanding it when i was learning so I thought it should be simpler than what others have been teaching.

  • @nzjemountfort
    @nzjemountfort 6 ปีที่แล้ว

    Excellent Tutorial - in the first minute you pointed out some issues that took me a long time to even identify a while ago, that will help save ALOT OF PEOPLE ALOT OF TIME!

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว

      I did suffer from the same when i started and I thought its important for people to know. Thanks for watching!

  • @donnacampbell9187
    @donnacampbell9187 6 ปีที่แล้ว

    Thank you so much...I am doing an Angular final in school and you have so helped me understand this !!Bless you!

  • @dollardreams5811
    @dollardreams5811 6 ปีที่แล้ว +8

    Hi techsith your tutorial is very informative plz upload full series on angular6 it's very helpful

  • @MrNagamalli
    @MrNagamalli 6 ปีที่แล้ว +1

    Hi, your online session presentation is awesome.

  • @jezzyfizzo
    @jezzyfizzo 6 ปีที่แล้ว +2

    All your videos including the JavaScript ones are great. Thanks for the help!

  • @manueldiera6781
    @manueldiera6781 6 ปีที่แล้ว +1

    This was great, you have a great way of explaining things and actually showed how to do this step by step. Thanks!

  • @maynorsonglara
    @maynorsonglara 5 ปีที่แล้ว

    Well done tutorial, very explanatory, really amazing edition cutting the unnecessary typing time. Congrats!

  • @davidconnelly
    @davidconnelly 6 ปีที่แล้ว

    Another great video (and thanks for answering my question, previously). You are knocking this out of the park. I just can't understand why you're doing all this for free. Anyway, thanks again for this. You're brilliant.

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว

      Thanks David for the kind words. Actually I had started creating a udemy course on Angular, I was half way through and someone stole my computer from my car so I lost all the work . I decided that I am going to keep it free to the world . May be one day I can create udemy course.

  • @harshu1982
    @harshu1982 6 ปีที่แล้ว

    Thanks mate, I understood your tutorials very easily...have had been following many, but this helped me a lot actually.

  • @gondrajkumar8783
    @gondrajkumar8783 5 ปีที่แล้ว +1

    thank you so much...today i learn new and first time ..........it possible for this tutorial.
    it great teaching .....

  • @abinmathew7708
    @abinmathew7708 6 ปีที่แล้ว

    Small and beautiful tutorial for a beginner

  • @bohdanartemenko
    @bohdanartemenko 6 ปีที่แล้ว +1

    Oh my god thank you, i tried to find about how to fix that cross-origin for a long time, only this video tutorial helped me :)

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว +2

      Initially i struggled a lot on CORS issue and i could not find a good solution anywhere . So i understand your frustration. I am glad I could help. :)

    • @himanshuupreti9457
      @himanshuupreti9457 6 ปีที่แล้ว +1

      Jsonp is the answer for CORS..

  • @CarlHamilton1914
    @CarlHamilton1914 5 ปีที่แล้ว

    Excellent. This is exactly what I was looking for. To the point!

  • @madant2697
    @madant2697 6 ปีที่แล้ว

    a very good and easy to understand tutorial..ty sir..

  • @akai2112123
    @akai2112123 5 ปีที่แล้ว

    Thank you so much for the interceptor module ! Loved the video . Cheers

  • @abhig3871
    @abhig3871 6 ปีที่แล้ว

    Cool stuff TechSith, liked the get & Post requests

  • @tayyabqazi143
    @tayyabqazi143 4 ปีที่แล้ว

    Bundle of thanks for this video I was searching a lot for this please upload a tutorial about mapping

    • @Techsithtube
      @Techsithtube  4 ปีที่แล้ว

      Like Map function in react?

  • @thisalma
    @thisalma 4 ปีที่แล้ว +1

    Thank you so much for the videos ...

  • @indianfootball2328
    @indianfootball2328 6 ปีที่แล้ว +1

    simplified and awesome, thanks a lot

  • @orgestbeqiri488
    @orgestbeqiri488 5 ปีที่แล้ว

    Sir, you are a life savior.

  • @matheusrambo8760
    @matheusrambo8760 6 ปีที่แล้ว +1

    Thank you so much, from Brazil!

  • @nirajdewangan3508
    @nirajdewangan3508 6 ปีที่แล้ว

    thank you, for such a great tutorial.. I am beginner to angular and this series is helping me lot

  • @mahevstark9950
    @mahevstark9950 6 ปีที่แล้ว

    love you, thanks, bundle of thanks. you should know it only you're (very) public who is working with angular 5 :) even angular.io doesn't have such guides.

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว

      Thanks Faisal, ANgular documentation is confusing that is why i am creating these tutorials make more sense.

  • @ashishrprastogi
    @ashishrprastogi 4 ปีที่แล้ว +2

    Hi Sir, I need your help. I got one API which is working on postman but when I have tried to call though angular code it is not working.. showing error

  • @edwar8117
    @edwar8117 6 ปีที่แล้ว +2

    De Verdad muchas gracias mi pana, desde Venezuela. saludos!!

  • @StanleyBateswar
    @StanleyBateswar 6 ปีที่แล้ว +1

    Explained very well. Thanks!

  • @AnjaniNaina
    @AnjaniNaina 5 ปีที่แล้ว +3

    Hi Sir, I need help, can you please tell me how can I call an API which belongs to different domain form my localhost server, because currently, I am facing the cross-origin issue.

  • @shivakumar3955
    @shivakumar3955 6 ปีที่แล้ว

    Nice videos.Request you to please add more questions on Angular 2

  • @adnuzzolillo
    @adnuzzolillo 6 ปีที่แล้ว +1

    Very well explained, You are awesome man!

  • @navdeepbains3481
    @navdeepbains3481 4 ปีที่แล้ว

    i appreciate your teaching style sir but i think you should have told about pipe operator and three functions error complete

  • @VertoSH
    @VertoSH 6 ปีที่แล้ว

    So clear and easy to understand. Nicely done ;)

  • @frankkismann1043
    @frankkismann1043 6 ปีที่แล้ว +6

    Muchas gracias, desde Chile.

  • @ronniekemper8142
    @ronniekemper8142 ปีที่แล้ว

    good teaching thank you stranger

  • @VirajWagh
    @VirajWagh 6 ปีที่แล้ว

    right to the point !!! Perfect explanation!

  • @thinagarankharidass
    @thinagarankharidass 6 ปีที่แล้ว

    Thanks for the video! Awesome explanation!

  • @chejoarevalo
    @chejoarevalo 5 ปีที่แล้ว

    Nice video!! it helps me a lot!

  • @sanjayprasad6776
    @sanjayprasad6776 6 ปีที่แล้ว

    Thanks for the wonderful video. Sir I would like to request you to make video on lazy loading.

  • @maheshik2577
    @maheshik2577 5 ปีที่แล้ว +1

    Thanks for the tutorial.

  • @ak19254
    @ak19254 6 ปีที่แล้ว

    Awesome.... Very Productive tutorial..

  • @chengxiaoxia8046
    @chengxiaoxia8046 5 ปีที่แล้ว

    Thank you very much, techsith. I compare your tutorial videos with others. Your vedio is more compact, informative, and better organized. I like your videos very much.I coded according to your teaching step by step and met 2 problems and I solved it . I want to share with others.
    1, because angular use json format to exchange data, when you use a local server based on PHP and Mysql, pls not forget to configure a right header when post a request, (postProfile(){
    this.httpClient.post('localhost:8000/threads',{
    title : "aaa",
    body : "bbb"
    }, {headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
    .subscribe(
    and at the server side,
    $postdata = file_get_contents("php://input");
    $request = json_decode($postdata);
    2, cors( cross orgin) error is not a default of angular, it is a security limitation from browser. For Macbook, I use this command to avoid i : $ open -a Google\ Chrome --args --disable-web-security --user-data-dir

    • @Techsithtube
      @Techsithtube  5 ปีที่แล้ว

      Appreciate the comment Cheng. Keep on learning

  • @vsooriyabandara
    @vsooriyabandara 6 ปีที่แล้ว

    This is very helpful . Thanks a lot for your effort.

  • @someshnukala804
    @someshnukala804 3 ปีที่แล้ว

    Great sir. Thank you so mush sir

  • @ErwinCorzo
    @ErwinCorzo 6 ปีที่แล้ว

    Me gustan muchos sus videos, gracias!!!.

  • @kevinbrosnahan2416
    @kevinbrosnahan2416 5 ปีที่แล้ว

    Thanks man! This really helped me out!

  • @sekharsamanta6561
    @sekharsamanta6561 6 ปีที่แล้ว

    Very useful tutorial

  • @relangirama
    @relangirama 4 ปีที่แล้ว

    This is very informative, Thanks for this tutorial

    • @Techsithtube
      @Techsithtube  4 ปีที่แล้ว

      Thanks for watching Ram.

  • @ranavaibhav1
    @ranavaibhav1 6 ปีที่แล้ว

    @techsith great tutorial, thanks so much. Can you explain how would basic authentication work in the same example?

  • @Latif127
    @Latif127 6 ปีที่แล้ว

    Very clear and nice tutorial

  • @ruchirai5775
    @ruchirai5775 6 ปีที่แล้ว +1

    Nice videos.Request you to please add more questions on CSS html

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว

      Yes I have plan to add some more videos on CSS interview questions.

  • @talksurajsingh
    @talksurajsingh 4 ปีที่แล้ว

    Very nice sir je 🎉🎉

  • @saranyaasokan1630
    @saranyaasokan1630 4 ปีที่แล้ว

    Thanks for this video

  • @azimkazi9374
    @azimkazi9374 6 ปีที่แล้ว

    Very great... Much more helpful

  • @ayushisrivastava2794
    @ayushisrivastava2794 5 ปีที่แล้ว +2

    Sir plz make a video on state management in angular 7

  • @fernandosouza2388
    @fernandosouza2388 6 ปีที่แล้ว

    awesome tutorial, thanks bro, abraços do Brasil

  • @viniciogomez9863
    @viniciogomez9863 6 ปีที่แล้ว

    I have problems with the post for the sent through slim framework 3, Error say "Failed to load resource: the server responded with a status of 405 (Method Not Allowed)" sends as method "Option". I'm using Angular 6.

  • @ashrafomar4034
    @ashrafomar4034 4 ปีที่แล้ว

    thank you a YOU ARE AMAZING ,it helped me a lot

  • @krishnanshankarasubramania3883
    @krishnanshankarasubramania3883 5 ปีที่แล้ว

    Good one. Useful. One question: if we have multiple HttpClient url to get or post how to handle the access control allow origin? Is it possible to pass multiple URL in the interceptor?

  • @VinothKumar5403
    @VinothKumar5403 6 ปีที่แล้ว +4

    awesome tutorial..

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว +1

      Thanks for watching! :)

  • @yogith9417
    @yogith9417 5 ปีที่แล้ว +1

    If you are using the in-house developed spring boot API, just adding @CrossOrigin to controller will solve the Cross Origin problem.

    • @Techsithtube
      @Techsithtube  5 ปีที่แล้ว

      Thats awesome. is it open sourse?

    • @yogith9417
      @yogith9417 5 ปีที่แล้ว

      @@Techsithtube Yeah. Infact it is provided in spring framework itself, just like @RestController, @RequestMapping etc annotations.
      For more info on how to use it, www.baeldung.com/spring-cors

  • @ravilynplus1183
    @ravilynplus1183 6 ปีที่แล้ว

    Thank you a lot!! I spended days trying to fix this problem

  • @alexskateu2
    @alexskateu2 6 ปีที่แล้ว +1

    Eres un buenazo!! excelente tutorial

  • @fkamal
    @fkamal 3 ปีที่แล้ว

    Great thank you very much

  • @sharmadeepika2712
    @sharmadeepika2712 5 ปีที่แล้ว

    it is very helpful... thanks

    • @Techsithtube
      @Techsithtube  5 ปีที่แล้ว

      Thanks for watching Deepika.

  • @gvamsikrish104
    @gvamsikrish104 5 ปีที่แล้ว

    It was so nice sir

  • @MattDuarte11
    @MattDuarte11 6 ปีที่แล้ว

    Super helpful you got another sub

  • @Reaper_f30
    @Reaper_f30 5 ปีที่แล้ว

    hey man nice tutorial.. question though.. should api call not be done in a service file instead?

  • @FadilMucia
    @FadilMucia 6 ปีที่แล้ว +1

    Hi @Techsith and thanks for this video. I really understood how to do GET and POST. THANKS.
    I have a question now. Let's take this code you did here.
    How can I print a list of "users" that are in that JSON file? I need for sure an Array, but how can I populate an Array of a json file that exist in a URL?
    Thanks again.
    Please, if someone knows the answer, I would appreciate the help :)

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว +2

      If they are inside a json file than you would have to navigate to the array. for example returning Obj = { users:[]} then you have to say myUsersArray = Obj.users; Does that answer your question?

  • @clashwithcj7428
    @clashwithcj7428 6 ปีที่แล้ว

    great video helped alot solved nicely

  • @nakulnagariya7736
    @nakulnagariya7736 6 ปีที่แล้ว

    Thanks, nice tutorial.

  • @nagarjuna1207
    @nagarjuna1207 6 ปีที่แล้ว

    I might be very bad in basics but want to know why we are importing any module two times? Once in app.module.ts and again in the actual component file where we are going use. Am I missing anything

  • @sksoumitrakar
    @sksoumitrakar 5 ปีที่แล้ว

    How to pass Cookie in header of Get request? I have been searching this since days but didn't get an answer

  • @suraj1749
    @suraj1749 5 ปีที่แล้ว

    Thank you.. Keep up the good work.. 😀

  • @mr.techno-era7474
    @mr.techno-era7474 6 ปีที่แล้ว

    Sir, but applying cors on every HTTP request does not create any security issue.

  • @vinaynr8103
    @vinaynr8103 6 ปีที่แล้ว

    very helpful
    thank you sir

  • @poojachauhan2228
    @poojachauhan2228 6 ปีที่แล้ว +2

    grt video for learner

  • @anuragpatel3976
    @anuragpatel3976 6 ปีที่แล้ว

    This is really nice and helpful.
    it would be more better if you create components and module manually that might give better understanding of concepts.
    not all vedios only one would be fine.

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว

      Anurag I have created components manually in first few videos. basically, when you create a component via cli you would see what has been created in the command line so follow that. I have a video on JavaScript modules check it out.

    • @anuragpatel3976
      @anuragpatel3976 6 ปีที่แล้ว

      Yes, I have seen your javascript videos they are really helpful.

  • @rahulnadgauda9961
    @rahulnadgauda9961 6 ปีที่แล้ว

    Nice tutorial sir.

  • @arunkravi3213
    @arunkravi3213 6 ปีที่แล้ว

    Great tutorial. Thanks. Well I didn't understand the last portion of the tutorial. While giving "http post request" , its not actually getting update in the "db.json" file. Only just id increment is showing. What have to do for the getting real updation to db.json file. Anyone please give me an answer.

  • @abhishekkamalkishor3793
    @abhishekkamalkishor3793 6 ปีที่แล้ว

    nice video, had a query ,how to send data in headers while http request, waiting to hear from you soon

  • @JorgeHernanvaldiviaTorrez
    @JorgeHernanvaldiviaTorrez 6 ปีที่แล้ว +1

    excelent!, thx man

  • @PonsianoDeLoor
    @PonsianoDeLoor 6 ปีที่แล้ว

    Gracias Bro saludos desde ecuador

  • @Диванныйаналитик-э9х
    @Диванныйаналитик-э9х 6 ปีที่แล้ว

    Thanks very much!

  • @neerajupadhyay1509
    @neerajupadhyay1509 6 ปีที่แล้ว

    Dear i have an problem when i am passing parameter in your given url
    can you please help me into this

  • @hemantkakodia9381
    @hemantkakodia9381 6 ปีที่แล้ว

    Hi. Thanks for the tutorial. I am facing the same issue while making a GET call to cross domain, i tried to add your Interception but even after that, i am facing same issue. Any suggestion would be welcome.

  • @seenuvasanv
    @seenuvasanv 6 ปีที่แล้ว +1

    Thanks

  • @ganapathilana7069
    @ganapathilana7069 6 ปีที่แล้ว

    need to update if your working in Angualr5 version.HttpClientModule in app.moudle.ts instead of HttpClinet. import in app.component.ts same. no change in that part

  • @ayyappaaryan3121
    @ayyappaaryan3121 6 ปีที่แล้ว +1

    Very informative

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว

      Thanks for watching! :)

    • @ayyappaaryan3121
      @ayyappaaryan3121 6 ปีที่แล้ว

      We should thank ...because your making time in this busy world and working to educate us Thanks For that :)

  • @SarahCrowley
    @SarahCrowley 6 ปีที่แล้ว +1

    Great video!!!

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว

      Thanks for watching Sarah!!

  • @ymazalmazal1757
    @ymazalmazal1757 6 ปีที่แล้ว

    Very nice, it seems to be for deeloppement only because the content of the json file is github...

    • @Techsithtube
      @Techsithtube  6 ปีที่แล้ว

      yes it is for development only.

  • @mukeshjha1805
    @mukeshjha1805 5 ปีที่แล้ว

    Thank u sir....

  • @erkanzileli
    @erkanzileli 6 ปีที่แล้ว

    chrome extension is absolutely necessary

  • @designxperts9815
    @designxperts9815 3 ปีที่แล้ว

    Sir Why we use * in angular? is there any logic behind.

  • @priscipo
    @priscipo 6 ปีที่แล้ว

    thank you ! you're great

  • @skverskk
    @skverskk 6 ปีที่แล้ว

    Maybe I'm missing something here. So, I add the interceptor.module.ts to the root area of my Angular5 App. I then add it to the app.module.ts file. I have a service that does CRUD operations. So, the part I'm not understanding is, where does this interceptor module fit into my angular app? Do I inject it into my component? Do I have to hard code my endpoint inside the interceptor.module file? Does anyone have a code snippet showing the whole process? Thanks for any help..

  • @rajugm1
    @rajugm1 6 ปีที่แล้ว

    Nice and useful Tutorial

  • @tigerreddy618
    @tigerreddy618 6 ปีที่แล้ว

    Awesome Sir..