AJAX hu li cas hauv AngularJS?
AJAX hu li cas hauv AngularJS?

Video: AJAX hu li cas hauv AngularJS?

Video: AJAX hu li cas hauv AngularJS?
Video: Muaj Yis hauv Xib tes yuav Qhia tau Txoj Hmoo li cas 2024, Kaum ib hlis
Anonim

Cov AngularJS muab kev tswj xyuas lub npe hu ua AJAX - $http, uas ua hauj lwm rau kev nyeem tag nrho cov ntaub ntawv uas muaj nyob rau ntawm cov chaw taws teeb servers. Qhov kev thov rau qhov xav tau ntawm cov ntaub ntawv xav tau tau ntsib thaum lub server ua rau cov ntaub ntawv hu los ntawm kev siv browser. Cov ntaub ntawv feem ntau xav tau hauv JSON hom.

Kuj paub, Ajax hu li cas?

Ib Ajax npe yog asynchronous thov pib los ntawm qhov browser uas tsis ncaj qha ua rau nplooj ntawv hloov pauv. Ib servlet thov yog Java-cov lus tshwj xeeb (servlets yog Java specification) rau kev pabcuam HTTP thov uas tuaj yeem tau txais ib qho yooj yim GET lossis POST (etc) lossis ib qho Ajax thov.

Ib yam li ntawd, Ajax siv rau dab tsi? AJAX = Asynchronous JavaScript thiab XML. AJAX yog ib txoj hauv kev los tsim cov nplooj ntawv web sai thiab dynamic. AJAX tso cai rau cov nplooj ntawv web kom hloov kho asynchronously los ntawm kev sib pauv cov ntaub ntawv me me nrog cov neeg rau zaub mov tom qab. Qhov no txhais tau hais tias nws tuaj yeem hloov kho qhov chaw ntawm nplooj ntawv web, tsis tas yuav rov qab tag nrho nplooj ntawv.

Ib yam li ntawd ib tug yuav nug, dab tsi yog $HTTP hauv AngularJS?

$ http yog ib AngularJS kev pabcuam nyeem cov ntaub ntawv los ntawm cov chaw taws teeb servers. Qhov $ http yog core AngularJS kev pabcuam uas siv los sib txuas lus nrog cov chaw taws teeb HTTP kev pabcuam ntawm browser's XMLHttpRequest object lossis ntawm JSONP.

Qhov kev pabcuam twg yog siv los ua Ajax hu rau server?

AngularJS AJAX - $http. $http yog AngularJS kev pabcuam rau kev nyeem cov ntaub ntawv los ntawm tej thaj chaw deb servers.

Pom zoo: