Це відео не доступне.
Перепрошуємо.

switchMap() | RxJS TUTORIAL

Поділитися
Вставка
  • Опубліковано 18 сер 2024
  • Awesome RxJS Operators - this time: switchMap(). What is it and how may we use it?
    Code (Start): jsfiddle.net/1...
    Code (End): jsfiddle.net/y...
    Want to become a frontend developer? Consider diving into some of my courses:
    Angular vs React vs Vue - Quickstart and Comparison: acad.link/ng-v...
    Ionic + Angular - The Practical Guide: acad.link/ionic
    Angular - The Complete Guide: acad.link/angular
    Vue.js - The Complete Guide: acad.link/angular
    You can follow me on Twitter (@maxedapps), Facebook ( / academindchannel ) or visit our Website (www.academind.com).
    See you in the videos!

КОМЕНТАРІ • 131

  • @karensarmiento6846
    @karensarmiento6846 3 роки тому +18

    Amazingly explained! The documentation is incredibly confusing on this but you cleared up all of my confusion right away.

    • @nergrohombre
      @nergrohombre Рік тому +2

      I agree, I think we need a real life example with a type ahead or something, but this is WAY better than the documentation

  • @anishspillai2225
    @anishspillai2225 7 років тому +40

    I broke my head whole day to understand Switch map..google also did not help me ..most of the explanations were literally confusing..luckily I got to watch ur video..Thanks a lot for ur excellent explanation..

    • @academind
      @academind  7 років тому +5

      It makes me really happy to read, that my explanations helped you Anish. Thank you for sharing this :)

  • @arpanbanerjee8584
    @arpanbanerjee8584 4 роки тому +5

    Thank you Max for making these videos on Rxjs, there is a dearth of clear cut info availability on the internet. I am here after your angular course on Udemy ! I learned a lot from it. Thanks again!

  • @sponefromrainbow4869
    @sponefromrainbow4869 4 роки тому +1

    switchMap() is very complicated to understand but with your explanation, you make stuff easy, thank you so much.

  • @davidtheprogrammer
    @davidtheprogrammer 7 років тому +15

    This is the first explanation of switchMap i've actually understood. Thank you!!

    • @academind
      @academind  7 років тому +1

      Thanks so much Muma, makes me really happy to read that the video helped you!

    • @virendrapatel775
      @virendrapatel775 4 роки тому

      👍👍

  • @gregorsondermeier9929
    @gregorsondermeier9929 5 років тому +1

    I was looking to find an explanation to finally understand the difference between mergeMap() and switchMap(). I think now I do. Thanks!

    • @academind
      @academind  5 років тому

      Great to read that the video was helpful for you Gregor, thanks a lot!

  • @nergrohombre
    @nergrohombre 2 роки тому

    Thank you for getting to the point quickly and not wasting our time, EXCELLENT!!!!!!!!

  • @harsimerkaur4792
    @harsimerkaur4792 6 років тому +1

    I have just finished watching 8 out of 11 wonderful videos on observables you have made. Could not find such explaination anywhere on internet. You have made this subject easier. Thanks @Academind! Keep up the Great work!

    • @academind
      @academind  6 років тому +1

      Thank you so much for your sharing this absolutely fantastic feedback Harsimer! This really means a lot to me :)

    • @harsimerkaur4792
      @harsimerkaur4792 6 років тому +1

      Academind sir, It is an honour for me to receive a reply from an expert like u. Thanks again! Made my day. :)

  • @eveanthonyu.rondina2546
    @eveanthonyu.rondina2546 2 роки тому

    Thank you. It solves my problem in nested observable on angular auth guard

  • @alexwilson3380
    @alexwilson3380 6 років тому

    A lot of the rxjs stuff hurts my brain. This video is really helpful and is possibly the only clear explanation I have found. Keep doing what you're doing.

    • @academind
      @academind  6 років тому

      Really fantastic to read that my video helped to make things a bit clearer for you Alex, I'll try my best to keep it up!

  • @feliksgoldin5781
    @feliksgoldin5781 6 років тому

    I have been searching for a switchMap() explanation for awhile now and thanks to you I finally understand this operator. Thank you so much!

  • @AGUNGKAYA
    @AGUNGKAYA 2 роки тому

    I like Max explain it straighforward and easy to understand

  • @88spaces
    @88spaces 3 роки тому

    You have great videos about rxjs that are easy to understand and make the life of a developer easier.

  • @icavir
    @icavir 2 роки тому

    Thanks for the explanation. Minimal and simple, just what you need to understand switchMap.

  • @98milok
    @98milok 5 років тому +1

    I LOVE YOY GUY! Last night, i no understand nothing about that, but now, i understand very good the switchMap operator. Thanks man!

  • @timothygrashaw5233
    @timothygrashaw5233 2 роки тому

    You're a godsend Max. Thanks!

  • @kamalkamals
    @kamalkamals 6 років тому

    This course of rxjs is very important to approach with ngrx, thank you Maximilian and keep up.

    • @academind
      @academind  6 років тому

      Thank you very much for your comment Kamal, it makes me really happy to read that you liked the video!

    • @kamalkamals
      @kamalkamals 6 років тому

      with pleasure.

  • @prateekbhardwaj9943
    @prateekbhardwaj9943 4 роки тому +43

    can i apply switchMap to my wife's repeated arguments

    • @unclesame
      @unclesame 4 роки тому +7

      Lol, you will have to unsubscribe from the arguments. unsubscribe()

    • @fredgarati
      @fredgarati 4 роки тому +1

      hahaha 'import { switchMap } from 'rxjs/operators' first

    • @tranhuuthu991990
      @tranhuuthu991990 3 роки тому +4

      It’s your fault. If you did not subscribe to her voice, you would never hear it.

    • @RostY
      @RostY 2 роки тому +1

      in version 8.x of RxJS they will add switchWife operator.

    • @user-gb6gw9hj3s
      @user-gb6gw9hj3s 2 роки тому

      Assume you had one

  • @salmi_azrinparentsonly863
    @salmi_azrinparentsonly863 2 роки тому

    I have fallen in love with your french accent. French people are good teachers!!

  • @dixitkhanal8885
    @dixitkhanal8885 4 роки тому

    I was in trouble with this operator. Thanks a lot man. It cam in handy at the moment. I am subscribing you right away.

  • @lowzhao
    @lowzhao 4 роки тому

    Very clear video thank you. I know its not HD, but the content is HD.

  • @unity3dconcepts434
    @unity3dconcepts434 6 місяців тому

    No matter what I watch what i read, unless I watch your videos i don't get the concept completely. hahahaha... thanks bro.

  • @forgotten225522
    @forgotten225522 2 роки тому

    Incredibly clear explanation. Thank you!

  • @samybaxy
    @samybaxy 5 років тому +2

    Great tutorial - Finally switchMap makes sense to me :)

  • @v1234able
    @v1234able 6 років тому +1

    Ghost of Rxjs is no more . thq

  • @DonTaldo
    @DonTaldo 3 роки тому

    Excellent explanation!

  • @bharathmkulkarni9411
    @bharathmkulkarni9411 24 дні тому

    Very well explained!

  • @IsmayilIsmayilov
    @IsmayilIsmayilov 4 роки тому

    ​ @Academind You are great tutor . Explained perfectly thanks for that.

  • @_bykt
    @_bykt 5 років тому +2

    Excellent explanation.

  •  4 роки тому

    man, i do really aprecciate your videos! Thanks for the help! Keep it up

  • @yYp4rtybo1Xx
    @yYp4rtybo1Xx 4 роки тому

    Thank you sir, finally I understood switchMap !!

  • @luxxart
    @luxxart 4 роки тому

    Very clear explanation - thank you!

  • @douglasperez3701
    @douglasperez3701 Рік тому

    Such a great video! 🤘

  • @leolanese
    @leolanese 6 років тому

    Simpler explanation ever! Well done

    • @academind
      @academind  6 років тому

      Thanks so much for your comment Leo, happy to read that you liked the explanation!

  • @88dejw
    @88dejw 5 років тому

    I had problem spotting differences between switchMap and mergeMap, until I found a quote on Medium: "So here’s the simple difference - switchMap cancels previous HTTP requests that are still in progress, while mergeMap lets all of them finish."

  • @sanjeetbahadur9377
    @sanjeetbahadur9377 3 роки тому

    great explanation

  • @KeganVanSickle
    @KeganVanSickle 4 роки тому

    Great tutorial Max!

  • @verryondrums
    @verryondrums 5 років тому

    Thanks for your videos! They are so helpful! I'm developing for such a long time and really got stuck with all those RxJS stuff... your explanations helped a lot!

    • @academind
      @academind  5 років тому

      Awesome to read that Verry, thank you very much!

  • @jesulalu6594
    @jesulalu6594 4 роки тому

    Awesome... nandri it was so understandable... mikka mikka nandri

  • @EPustovit
    @EPustovit 6 років тому

    Pretty clear explanation! Thank you!

    • @academind
      @academind  6 років тому

      Thanks a lot Erop, it really makes me happy to read that!

  • @lasseandreasen1518
    @lasseandreasen1518 6 років тому

    this is an awesome explanation - thank you

    • @academind
      @academind  6 років тому

      So happy to read that you like the video Lasse, thank you for your comment!

  • @riteshpatidar9184
    @riteshpatidar9184 4 роки тому +1

    Thanks, you made it so simple to understand... I am subscribing to your UA-cam Observable/Channel😅

  • @alainkr
    @alainkr 3 роки тому

    Super clear

  • @udaybsvs8699
    @udaybsvs8699 3 роки тому

    good explanation

  • @vincolasrj
    @vincolasrj 6 років тому

    Awesome explanation!! Help me a lot!!

    • @academind
      @academind  6 років тому

      So cool to read Vinícius, thank you very much for your comment!

  • @RohithVarma36
    @RohithVarma36 5 років тому +1

    awesome explanation...

  • @medivh1035
    @medivh1035 5 років тому +1

    the compiler tells me switchMap is not a property of Observable?????

  • @kekinchheda8097
    @kekinchheda8097 2 роки тому

    Can I apply switchMap() operator more than once one after another?

  • @uncle-xxi
    @uncle-xxi 4 роки тому

    That was very helpful! Thanx a lot!!!

  • @alshojamikbal8510
    @alshojamikbal8510 5 років тому

    Finally got what switchmap is OMG :O and can you please explain it with Angular 6 +

  • @barjosa31blogspot83
    @barjosa31blogspot83 6 років тому

    Thank You! Indeed it's helpful!

    • @academind
      @academind  6 років тому

      That's just great to read, thanks a lot for your support!

  • @inframatic
    @inframatic 3 роки тому

    Isn’t it confusing to type an observable in one way and then it returns something different than the type of the first? Maybe I misunderstanding this

  • @aprofromuk
    @aprofromuk 7 років тому

    Hey many thanks for the tutorials, quick question, what would be the best way to do if else in RxJS please?

  • @ahmedalhisaie7698
    @ahmedalhisaie7698 6 років тому

    Thanks, it was clear, but we would like to see these explanations in real situation, right now these operators been used intensively in Ngrx effect , it would be great if you could explain it with that.

  • @sachinhajare5404
    @sachinhajare5404 3 роки тому

    how do we cancel old HTTP request and subscribe to new which are not triggered from an event ?

  • @grzegoszbrzeczyszczykiewic7753
    @grzegoszbrzeczyszczykiewic7753 5 років тому

    Best explanation , thanks!

    • @academind
      @academind  5 років тому

      Thanks so much Grzegosz!

  • @danielubanan5503
    @danielubanan5503 2 роки тому

    Thank you.

  • @ngyi3553
    @ngyi3553 6 років тому +1

    Do swicthMap() exists on Subject and BehaviorSubject?

    • @academind
      @academind  6 років тому

      You can use all observable operators on all observable-"like" objects like Subjects, too, yes.

  • @TahaZgued
    @TahaZgued 6 років тому

    Excellente explanation, thanks man keep on

    • @academind
      @academind  6 років тому

      Very happy to read that you like the video Taha, I'll try my best to keep it going!

  • @thepumpedupgeek
    @thepumpedupgeek 6 років тому

    I get that it stops old subscriptions, but how's it changing the values?

  • @dxcqcv
    @dxcqcv 5 років тому

    can you make a video about exhaustMap?

  • @videderien2
    @videderien2 7 років тому

    What are differences between MergeMap and SwitchMap ?

  • @selimatasever4112
    @selimatasever4112 2 місяці тому

    why didnt he use pipe function? I thought it was required to create chain operators

  • @NBUltra187
    @NBUltra187 5 років тому

    i wish people would use real world examples for such topics.

  • @cunhalopes8593
    @cunhalopes8593 6 років тому

    I tried to execute in Angular 5 + typescript.
    but I've got this error :
    error TS2322: Type 'void' is not assignable to type 'string'.
    import { Component, ViewChild, EventEmitter,OnInit, OnDestroy } from '@angular/core';
    import { Observable, Observer } from "rxjs";
    import "rxjs/add/observable/interval";
    import "rxjs/add/operator/take";
    import "rxjs/add/operator/map";
    import "rxjs/add/operator/bufferCount"
    import { Subscription } from 'rxjs/Subscription';
    import { Subject } from 'rxjs/Subject';
    @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
    })
    export class AppComponent implements OnInit {
    /*
    @ViewChild("button") button: ElementRef;
    subscription : Subscription;
    */
    constructor(){
    }
    onDestroy() {
    // this.subscription.unsubscribe();
    }
    ngOnInit(): void {
    let input1 = document.querySelector('#input1');
    let input2 = document.querySelector('#input2');
    let span = document.querySelector('span');
    let obs1 = Observable.fromEvent(input1,'input');
    let obs2 = Observable.fromEvent(input2,'input');
    obs1.mergeMap(
    (event1:Response)=>{
    return obs2.map((event2 : Response)=>{
    event1['target']['value']+' '+event2['target']['value']
    })
    }
    ).subscribe(
    (combinedValue )=>{ span['textContent'] =combinedValue;console.log(combinedValue);}
    );
    }

  • @BULLSHXTYT
    @BULLSHXTYT 7 років тому +2

    It takes time to understand... I can't understand it for the first time

  • @alan614
    @alan614 6 років тому

    Keep up the great work !

    • @academind
      @academind  6 років тому

      I'll try my best, thank you so much!

  • @ksas323
    @ksas323 3 роки тому

    Danke Bruder

  • @wOOx92
    @wOOx92 4 роки тому

    Can you do another video for exhaustMap, pls? :)

  • @skyknight1989
    @skyknight1989 5 років тому

    Finally I'm starting to understand this switchMap thing :D haha... isn't it what a throttle design pattern does?

    • @bohdanonufriychuk5500
      @bohdanonufriychuk5500 3 роки тому

      Can you share a link to what do you mean bt saying `throttle design pattern`?

  • @codeative
    @codeative 6 років тому

    So clear .. Thank you

    • @academind
      @academind  6 років тому

      Thanks so much Mostafa!

  • @xnivaxhzne
    @xnivaxhzne 4 роки тому

    Love u man

  • @odia-sanatani
    @odia-sanatani 5 років тому

    'Rx.' where we can import in angular

  • @nafishasnian1367
    @nafishasnian1367 7 років тому

    Max i like your Rxjs series But Everybody is waiting for project based series including me. Stuff that we cant learn by reading documents. I would love to see large scale social network/shopping card based projects. UA-cam lacks those types of videos. Most of the videos are short and doesn't show the right way to do it rather the simple way to do it. If you can, please Make the concept or core technology based videos on Udemy and Project based videos on UA-cam. If they dont understand your project based videos you can always suggest them your Udemy courses.

    • @academind
      @academind  7 років тому +1

      Thanks for your feedback Nafis! I haven't abandoned project-based series, no worries but I want to cover a broad range of topics and I of course I only want to create such a series if I a) have the time and b) have topics which make sense. There will be project-based videos in the future

    • @nafishasnian1367
      @nafishasnian1367 7 років тому

      Okay awesome. Keep up the good work

  • @AhmedZERZERI
    @AhmedZERZERI 7 років тому

    great job max keep it up :) btw i love your angular 4 course on udemy!

    • @academind
      @academind  7 років тому +1

      Awesome to hear that, thanks so much Ahmed!

    • @AhmedZERZERI
      @AhmedZERZERI 7 років тому

      Can i put my email here? i'm starting a big project using angular and i really could use some advise from someone with your experience ! i will make sure not to take much of your time as i Can imagine you're a busy person :) thanks a lot again for your great work !

  • @N96123
    @N96123 7 років тому

    Where we gonna use this technically ? BTW Great series!

    • @academind
      @academind  7 років тому +2

      I'll try to share some projects on this channel where I also show some practical applications of RxJS, that should be helpful :)

  • @nergrohombre
    @nergrohombre 2 роки тому

    thanks,

  • @codigo_total
    @codigo_total Рік тому

    Buenardo

  • @Daavlot
    @Daavlot 4 роки тому

    I subscribed() to this channel

    • @academind
      @academind  4 роки тому

      Great to have you on board, thank you!

  • @artdronax6737
    @artdronax6737 7 років тому +1

    When we see creating real big projects? Example: Shopping Cart

    • @academind
      @academind  7 років тому +3

      I have two series about that on the channel already ;) Or do you mean with RxJS? There probably will be projects using it in the future, too - no worries.

    • @herpinmaderpful
      @herpinmaderpful 6 років тому

      You should buy his udemy courses, they are EXCELLENT, and you get to see stuff like this used in a larger project scope

    • @daydreameravani
      @daydreameravani 6 років тому

      Expecting a demo project that involved RxJS and Redux-Observer in the future.

  • @vukkumsp
    @vukkumsp 6 років тому

    Still I have a doubt. I learned that switchMap() is a similar to map() except map() is applied Array object while switchMap() is applied on Streams or Observables. How Observable is similar to an Array... this is really confusing me. please some one help me out,
    Thank you

    • @Andrew-tl9gk
      @Andrew-tl9gk 6 років тому +2

      RxJs .map() has nothing to do with arrays. It is for changing data (similar to Array.map). switchMap() is not for changing data, it is for subscribing to an Observable and cancel the old subscription at once.

  • @virendrapatel775
    @virendrapatel775 4 роки тому

    👍👍👍

  • @expertreviews1112
    @expertreviews1112 4 роки тому

    Why didn't he put switchMap inside pipe???

  • @LuXxenatorX
    @LuXxenatorX 5 років тому

    is this deprecated?

  • @chanlito4896
    @chanlito4896 7 років тому

    Academind?

    • @academind
      @academind  7 років тому

      Yep, changed the name ;)

  • @tomaszsikora6723
    @tomaszsikora6723 3 роки тому

    This is insanely overcomplicated. Love your tutorials though.

  • @alex.p
    @alex.p 6 років тому

    Thanks a lot! It was very helpful.

    • @academind
      @academind  6 років тому

      Thank YOU for your comment Alex, happy to read that :)