Dab tsi yog cov lus cog tseg hauv AngularJS?
Dab tsi yog cov lus cog tseg hauv AngularJS?

Video: Dab tsi yog cov lus cog tseg hauv AngularJS?

Video: Dab tsi yog cov lus cog tseg hauv AngularJS?
Video: Cog Lus Ua Dab Tsi Tuam Thoj Nkauj zoo ploog 2024, Kaum ib hlis
Anonim

A cog lus yog ib yam khoom uas rov qab los ntawm Deferred object. Koj tuaj yeem sau npe sib txawv callbacks rau cov xwm txheej sib txawv daws(), tsis lees paub(), lossis ceeb toom() thiab nws yuav ua tiav thaum lub async ua tiav. Deferred API: Ib qho piv txwv tshiab ntawm defer yog tsim los ntawm kev hu $q.

Ntawm no, kev siv cov lus cog tseg hauv AngularJS yog dab tsi?

Kev cog lus hauv AngularJS yog muab los ntawm kev pabcuam $q built-in. Lawv muab ib txoj hauv kev los ua haujlwm asynchronous hauv koob los ntawm kev sau npe nrog a cog lus khoom. {info} Cov lus cog tseg tau ua rau lawv txoj hauv kev rau hauv JavaScript haiv neeg raws li ib feem ntawm ES6 specification.

Tsis tas li ntawd, cov lus cog tseg hauv JavaScript yog dab tsi? JavaScript | Kev cog lus . Kev cog lus yog siv los tswj cov haujlwm asynchronous hauv JavaScript . Lawv yooj yim los tswj thaum cuam tshuam nrog ntau yam haujlwm asynchronous qhov twg callbacks tuaj yeem tsim kev hu rov qab ntuj raug txim ua rau tsis muaj cai tswj tau.

Ib yam li ntawd, tib neeg nug, angular 4 cog lus dab tsi?

A cog lus yog qhov chaw rau tus nqi yav tom ntej. Nws ua haujlwm tib yam li callbacks tab sis muaj cov syntax zoo dua thiab ua rau nws yooj yim dua los daws qhov yuam kev.

Cov lus cog tseg hauv TypeScript yog dab tsi?

A cog lus yog a TypeScript khoom uas yog siv los sau cov kev pab cuam asynchronous. A cog lus yog ib qho kev xaiv zoo dua thaum nws los tswj ntau yam haujlwm asynchronous, kev ua yuam kev thiab kev nyeem ntawv zoo dua. Peb paub tias dab tsi synchronous thiab asynchronous programs yog.

Pom zoo: