Cov txheej txheem:

Dab tsi yog qhov khoom ncua sij hawm hauv Angularjs?
Dab tsi yog qhov khoom ncua sij hawm hauv Angularjs?

Video: Dab tsi yog qhov khoom ncua sij hawm hauv Angularjs?

Video: Dab tsi yog qhov khoom ncua sij hawm hauv Angularjs?
Video: tos koj hauv nruab dab - nuj xeem - nkauj tawm tshiab fullMV 2021 2024, Hlis ntuj nqeg
Anonim

Deferred Object

Kev ncua yog ib khoom uas nthuav tawm cov lus cog tseg. Nws muaj peb txoj hauv kev daws(), tsis lees paub(), thiab ceeb toom(). Thaum twg Kev ncua ua tiav, Koj hu txoj kev daws teeb meem (), tsis lees paub(), thiab ceeb toom(). Nws hu xov tooj rov qab rau npe los daws teeb meem (), tsis lees paub (), lossis ceeb toom () raws li nws tau ua tiav

Kuj paub, qhov kev pabcuam $q ncua sijhawm thiab cog lus li cas?

A kev pabcuam uas pab koj khiav haujlwm asynchronously, thiab siv lawv cov nqi rov qab (lossis kev zam) thaum lawv ua tiav. Qhov no yog ib Kev cog lus /A+-raws li kev siv ntawm cog lus / ncua Cov khoom tshwm sim los ntawm Kris Kowal's Q.

Ib tug kuj tseem nug, $ cog lus li cas hauv AngularJS? 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.

Tsuas yog li ntawd, kev cog lus ncua sij hawm yog dab tsi?

version ntxiv: 1.5 ncua . cog lus () txoj kev tso cai rau kev ua haujlwm asynchronous los tiv thaiv lwm cov cai los ntawm kev cuam tshuam nrog kev nce qib lossis cov xwm txheej ntawm nws qhov kev thov sab hauv. Rov qab tsuas yog lub cog lus yam via ncua . cog lus () yog li lwm tus lej tuaj yeem sau npe hu rov qab lossis tshawb xyuas lub xeev tam sim no.

Tom qab ntawd hauv AngularJS yog dab tsi?

. tom qab ntawd hauv AngularJS . 1.. ces yog hu rau HTTP cog lus khoom thiab xa rov qab cov khoom cog lus tshiab. 2.o vim. ces rov qab cov khoom cog lus tshiab, nws tuaj yeem siv rau kev hu xov tooj.

Pom zoo: