Angular Tutorial - 21 - Fetch Data Using HTTP

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024
  • 📘 Courses - learn.codevolu...
    💖 Support UPI - support.codevo...
    💖 Support PayPal - www.paypal.me/...
    💾 Github - github.com/gop...
    📱 Follow Codevolution
    + Twitter - / codevolutionweb
    + Facebook - / codevolutionweb
    📫 Business - codevolution.business@gmail.com
    Angular | Angular Tutorial for Beginners | Fetch Data Using HTTP

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

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

    *There is a change in rxjs version 6. Please watch this video to fix that.*
    th-cam.com/video/ScaKGrW5s0I/w-d-xo.html

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

      Awesome, thank you!

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

      Very nice.....thnx.....do upload more videos

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

      iam using angular7 when i subscribed to observable it is showing error " cant find name 'subscribe' "

    • @miradama
      @miradama 5 ปีที่แล้ว +8

      @@ifthikkarudheent1159 Delete the ";" for the line before the .subscribe(data...

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

      can you please explain why we are creating an employee inetrface as we know what data is coming from backend and we can directly use it and subscribe it..

  • @Saurabh2816
    @Saurabh2816 4 ปีที่แล้ว +134

    Jeez, this video could win an Oscar if there was a category for 'Most clear explanation to a complex topic'.

    • @rembautimes8808
      @rembautimes8808 3 ปีที่แล้ว +1

      Second vote that - I was stumped for several hours on this , opening dozens of Stack Overflow and Angular IO files on how to accomplish this. The nice thing is how the interface was used to map the data. Vishwas does a great job for Angular newbies like myself ( total Angular experience ~ 16 days )*
      *From Python land , which is awesome but they don’t have material Ui

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

      Agree 110%

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

    For angular14 and other issues
    >> import {Observable} from 'rxjs';
    >> in subscribe() define the data type of 'data' FOR EXAMPLE .subscribe((data=any)=>)
    >> also in employee = [ ] do employee:any instead
    Overall everything is working completely fine.

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

    These videos deserve more views. I am currently learning angular and your videos are by far the best. You explain step by step in such an easy way that anyone would easily understand the process.

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

    your Angular series saved me from assignments, love your short and clear videos. Thank you!! ☺

  • @ДмитрийПавловский-д8э
    @ДмитрийПавловский-д8э 4 ปีที่แล้ว +10

    Man, thanks so much for your tutorials with detailed explanation! I started learning Angular with your videos.

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

    when I try the subscribing code, I get an error for the 'employee = []; cant assign type x[] to type never[] can someone help

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

      public employee:any[] = []; this will solve your problem

  • @Guinhulol
    @Guinhulol 5 ปีที่แล้ว +7

    Fix for those who are having issues with Observable on Angular 6+ just run the command "npm install rxjs-compat" then you should be good to go

  • @vanzinvestor
    @vanzinvestor 5 ปีที่แล้ว +42

    Angular 7 use
    *import { Observable } from 'rxjs';* instead of import { Observable } from 'rxjs/Observable'

    • @venkatsai-
      @venkatsai- 4 ปีที่แล้ว

      hello man did u get any solution for this

    • @CREED.32
      @CREED.32 4 ปีที่แล้ว +3

      @@venkatsai- What he has given IS the solution.

    • @NoName-vw9hl
      @NoName-vw9hl 3 ปีที่แล้ว

      Thank you so much

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

    Man, I love you! You explained so clear that even I undersrand. I mean, I spent really 9-10 hours to figure out how this schema works and you explained it within 2 videos. Glad you do this content! Even after 5 years from video appeared, it is still helpfull!

  • @Krazness
    @Krazness 4 ปีที่แล้ว +5

    You are a Godsend. I'm loving this series. Thank you!

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

    I do not speak and I do not understand English, but I was able to understand and learn a little Angular with your video.
    Thank you very much.

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

    great video...your clear audio, presentation screen, way of presentation, and words you have used, everything made this tutorial perfect and easy to grasp...

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

    Is creation of IEmployee structure unnecessary? putting instead, works

  • @Samuel-np5ng
    @Samuel-np5ng 6 ปีที่แล้ว +4

    I'm trying to do the same but, my employees array is always undefined. The data has the content and it is asigned to my array in the subscribe method because if have checked it. However, when the method its finished I check again my array employees and its empty, as if nothing had happened.

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

    Man thank you for this video. You thought me Redux and now you are teaching me Angular. :D

  • @lorem349
    @lorem349 2 ปีที่แล้ว +1

    For those getting error in the json array file,
    1) Replace all the single quotes with double quotes (can be done easily by using ctrl+h in vs code)
    2) Remove the comma from the last value of every object in the array

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

    Very good explanation. Not even Angular official site tutorial explains like this.

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

    one of the the likes that you are getting every day on your videos one by one are mine! Good work dude! I Subscribed on just completing your first video.!

  • @MZ-uv3sr
    @MZ-uv3sr 3 ปีที่แล้ว +1

    Oh wow that cleared up a lot very quickly. Also thank you for using a good readable font size.

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

    best described Observable and Subscription ever (starting at 5:20)

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

    no one has explained this subject the way u did it. love your videos.

  • @Kim-hm4nb
    @Kim-hm4nb 6 ปีที่แล้ว +2

    Hi, Sir, thanx for making tutorials on Angular 6. i learnt a lot of concepts from your tutuorials such as Di, Observables...etc
    i think your concepts are crystal clear! and also your teaching methodology is so much awesome!
    i like the way as you teach.
    Sir i'v a request, kindly make a tutorial on LOGIN AND REGISTRATION SYSTEM in MEAN STACK 6 or at least 5 using mongoose
    i am waiting your response imran khan from Lahore, Pakistan

  • @hakkihantunbak6340
    @hakkihantunbak6340 2 ปีที่แล้ว

    What an unbelievably clear explanation. Wow.

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

    error solves:
    1. if there is error in subscribe, then check if there is a semicolon in before line. If it's there, remove it.
    2.correct to public employees=[] as any; in both employee list and employee detail components
    3. remove last semicolon in employee.json
    4. correct it to import { Observable } from 'rxjs';

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

    Really Really useful. Very well explained. Thanks a million! Please do more video.

  • @AGUNGKAYA
    @AGUNGKAYA 3 หลายเดือนก่อน

    your explanation is the best. Hope you make more content with Angular's new features also

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

    Your video nice..i'm fresher so after two time watching your video then only I can understand....tq....

  • @harshaeranda3321
    @harshaeranda3321 6 หลายเดือนก่อน

    When god think I'm gonna teach anguler service today❤

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

    Thank God till this tutorial I didn't got stuck anywhere, got running everything. Thanks

  • @AnkitMishra-mo3dv
    @AnkitMishra-mo3dv 5 ปีที่แล้ว +1

    I am using Angular 8
    I have written code according to this video.
    But the detail of Employee list is not showing.

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

    Good Job man!!!very good way to explain the concepts in a easy way..Thanks

  • @anandmane3634
    @anandmane3634 2 ปีที่แล้ว

    I have been watching you angular videos and I have learned alot. Thanks...

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

    your video channel is very helpful for so many members and also very helpful for how are started as a beginner

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

    FYI - if your import of Observable is failing because you are using version 6 then try this:
    import { Observable } from 'rxjs';

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

      it is going to be automatically imported on VS code, it was puzzling at first but yeah

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

      For those who are using Angular 6+ just run the command "npm install rxjs-compat" then you should be fine.

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

      In Angular 6, this is done automatically, great

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

      Also applied to Angular 7: import { Observable } from 'rxjs';

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

    I like your examples, as every video is independent of previous video.

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

    Best explanation ever, veri simple and with examples. Well done, you saved me

  • @galleeandfarel
    @galleeandfarel 2 ปีที่แล้ว

    awesome explanation, the best in youtube

  • @jt.633
    @jt.633 2 ปีที่แล้ว

    thank you for this! you're a very good teacher and clear communicator!!

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

    I had an issue locating my employees.json file, I had an assets folder within src/app/assets and one within src/assets, I deleted the one in src/app/assets and put the json file in the src/assets folder directly and this got my app to work!
    Hope this helps anyone!

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

      I think you should add the file as an asset in the angular.json file

  • @purnimabaranwal
    @purnimabaranwal 2 ปีที่แล้ว

    Perfect way to explain. Thanks for putting so much efforts.

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

    Best explanation by far. Understood how Observable works under the hood.

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

    Great video!! What if i want to show only the people that have the name wich start with A?

  • @HK-sw3vi
    @HK-sw3vi 4 ปีที่แล้ว

    there are rarely any video that I like first then start watching

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

    thanks man!! I was finally able to make it work, your explanation is great!

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

    In general, quite a useful video.
    But in fact, the result is a memory leak in employee-list.compopent.
    You can solve this problem by assigning a subscription to a variable. eg this._subcription = this._employeeService.getEmp. And execute this._subcription.unsubscribe() in ngOnDestroy.
    Or it is better to not subscribe at all. Instead, display data through the async pipe in the template. This is the best practice - because Angular will take care of unsubscribe
    .

  • @jmmmmmmmmmk
    @jmmmmmmmmmk 8 หลายเดือนก่อน

    Thank you, good job explaining.

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

    HI viswas Thank you for making such a nice video. i have one confusion please help me.
    I have already setup Angular project and i have to create so many pages and each page have some static content. so
    my question is for each pages i need to create new component and for each component i need to create new services? or there is other way to do this.
    please make one video how to feach data from Database

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

    Really helpful and worked first time on Angular 8.

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

    Very nice way of explanation

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

    Thanks Friends, your are the best, I'm learning so fast. I could understand about services and observables.

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

    How would you code this to return an Observable and not the whole array? For example, in Java you you would do this with a Single, not an Observable.

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

    At 4.20 you must end the propertie names for the interface using a semicolon. No clue why it does not give you a warning but it's not a JSON-object.

  • @randallp.5578
    @randallp.5578 2 ปีที่แล้ว

    This is still such a helpful video.. This helped me understand Observables a bit more, thank you very much! will you post any videos using Angular 14?!

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

    those who are getting error in importing observables write import { Observable } from 'rxjs'; instead of import { Observable } from 'rxjs/Observable'; .

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

    one of the best angular series... Thanks Sir

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

    I did same as this TH-cam video but data is not printed on webpage. No errors are there. Employee details like id, name, age is not displaying. What the reason is??

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

    I notice on employee-list component you did not define “data” after you subscribed to the observable. Is that because the subscribe method knows that data means the information received from the observable?

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

      Thought I could help. Yes you are correct. data is just a variable name in the context and could have been anything. ex c1 => class variable = c1

  • @ashishchauhan5203
    @ashishchauhan5203 2 ปีที่แล้ว

    Hey man please use jsonplaceholder for API tutorials. Hard coded data is a big no no.

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

    Newer version edit: To
    import {Observable} from 'rxjs/observable';
    From now-on we can directly use:
    import {Observable} from 'rxjs';

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

    Sir what to do when you want to recieve multiple set of json data .... with that what you've shown we can only cast on one interface..!!
    Are we supposed to make a nested interface object to fit all the subset ??

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

    Amazing explanation of observables

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

    Thanks man, this helped me. And even more, this made mE to subscribe(); to your channel!
    *Bdum tsss* :)

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

    your explanation is great. This was very useful. Thank you

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

    This is really useful. Thank you so much!

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

    Very well explain.. You clarified my doubts. Thank you so much.

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

    very clear and neat explaination.thankyou so much👌

  • @DeepakGupta-s1z
    @DeepakGupta-s1z ปีที่แล้ว

    you helped me a lot. Thanks

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

    have you explained post meathod also in the same way?

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

    superb and awsome tutorial. Thanks alot for sharing. now I understood clearly . Great Tutorial

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

    Thank you so much for the explanation! It helps a lot.

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

    Watching this and not subscribing will be unfair. :)

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

    Excellent video series on Angular. I really appreciate the work you have done. Thank you!

  • @AhamedKabeer-wn1jb
    @AhamedKabeer-wn1jb 3 ปีที่แล้ว

    Beautifull explanation..

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

    Hi
    everything is working fine no error but no data is displayed i dont know what is the issue even i have used error handler
    please help me

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

    What about returning an array of employees instead of observable from the getemployees function and how it is implemented

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

    Brilliant explanation . Keep up the good work sir !!

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

    Hi,
    why do we use employee interface and not employee class. What is the benefit of using interface ?

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

    Very good explanation

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

    Saved my day thanks

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

    ERROR in ./src/app/EmployeeDetails/EmployeeDetails.service.ts
    Module not found: Error: Can't resolve 'rxjs/add/operator/map' in 'E:\angular\ApiData\src\app\EmployeeDetails'

  • @0111LFS
    @0111LFS 3 ปีที่แล้ว

    where is the employee list being requested from? Server side or from the browser?

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

    sir how can we fetch data from live server which changes should we made?

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

    appreciative work!! crystal clear concept till services thank you

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

    sir i follwed your steps but facing a single error my app is unable to find the json file which i made inside assets plz guide me

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

    I tried to fetch data from json file but I am getting empty array.

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

    Nice step by step explanation 👍

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

    why use observable and not promise? what is the difference between them?

  • @KamalSharma-zw3fl
    @KamalSharma-zw3fl 4 ปีที่แล้ว

    wow you are perfect, you are a very good teacher

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

    thanks for the explanation..

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

    Excelente...mejor imposible...bien explicado...Gracias..Saludos desde Venezuela

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

    Really helpful. thank you

  • @8irsan8
    @8irsan8 4 ปีที่แล้ว

    Question: how does the component know what fields to match when getting data from a backend. Meaning I do not see an assignment like id= .id. What if I named id to idd in my interface?

  • @AshishSingh-op2ul
    @AshishSingh-op2ul 6 ปีที่แล้ว

    The Big one Bro...Completely understandable

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

    when we work on the real project with server how to make the right folder structure and how manage all interfaces?

  • @md.julhashossain9758
    @md.julhashossain9758 6 ปีที่แล้ว

    So Cool Man !!!... Just Described On to the point .. Great Work. !!!

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

    you are superb sir, and your all videos are amazing.

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

    you are PRO BRO, keep cool and thanks!!

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

    Error Ts2339 : Property 'get' does not exist on type 'HttpClient'

  • @章魚-l8y
    @章魚-l8y 2 ปีที่แล้ว

    Awsome video man, I learnt a lot from your tutorial.
    May I know why we need to have underscore when naming a private variable? Is it necessary?