Dab tsi yog kev kawm thiab kev coj cwj pwm hauv angular?
Dab tsi yog kev kawm thiab kev coj cwj pwm hauv angular?

Video: Dab tsi yog kev kawm thiab kev coj cwj pwm hauv angular?

Video: Dab tsi yog kev kawm thiab kev coj cwj pwm hauv angular?
Video: qhia txog kev koj yuav coj cwj pwm hais lus li cas thiaj muaj phooj ywg kwv tij hwm koj 2024, Hlis ntuj nqeg
Anonim

A Kawm paub yog ob qho tib si soj ntsuam thiab soj ntsuam. A BehaviorSubject a Kawm paub uas tuaj yeem tawm tus nqi tam sim no ( Cov kawm tsis muaj lub tswv yim ntawm tus nqi tam sim no). Qhov ntawd yog qhov tsis meej pem. Qhov yooj yim yog siv nws. Cov BehaviorSubject tuav tus nqi uas yuav tsum tau muab faib rau lwm yam.

Hauv qhov no, qhov txawv ntawm qhov kev kawm thiab BehaviorSubject hauv angular yog dab tsi?

Lub xwb Qhov txawv ntawm BehaviorSubject thiab Kawm paub yog BehaviorSubject muaj tus nqi pib uas yuav raug tso tawm thaum sau npe rau.

Dhau li saum toj no, dab tsi yog kev kawm thiab BehaviorSubject? BehaviorSubject yog hom tshwj xeeb ntawm Kawm paub uas nws tsuas txawv yog tias nws yuav emit tus nqi kawg raws li ib tug tshiab soj ntsuam lub subscription.

Ntawm no, Dab tsi yog BehaviorSubject hauv angular?

A BehaviorSubject yog ib hom kev soj ntsuam tau (piv txwv li cov kwj ntawm cov ntaub ntawv uas peb tuaj yeem sau npe yuav zoo li kev soj ntsuam rov qab los ntawm HTTP thov hauv Angular ). Thaum koj sau npe rau nws, nws yuav tam sim rov qab tus nqi kawg uas tau tawm tam sim ntawd (lossis tus nqi pib yog tias tsis muaj cov ntaub ntawv tau tawm lawm)

Dab tsi yog kev siv cov ntsiab lus hauv angular?

Cov ntsiab lus hauv Angular 2/4/5/6. Ib tug observable tso cai rau koj mus sau npe tsuas yog whereas a yam tso cai rau koj tshaj tawm thiab sau npe. Yog li ntawd a yam tso cai rau koj cov kev pabcuam siv los ua tus tshaj tawm thiab cov neeg siv khoom.

Pom zoo: