Dab tsi yog input thiab output nyob rau hauv angular?
Dab tsi yog input thiab output nyob rau hauv angular?

Video: Dab tsi yog input thiab output nyob rau hauv angular?

Video: Dab tsi yog input thiab output nyob rau hauv angular?
Video: Ua Dab Tsi Txhaum Koj - David Yang (New Song 2021) 2024, Hlis ntuj nqeg
Anonim

Ua ntej tshaj plaws, lub tswv yim ntawm Input thiab Output yog los pauv cov ntaub ntawv ntawm cov khoom. Lawv yog cov txheej txheem xa / tau txais cov ntaub ntawv los ntawm ib feem mus rau lwm qhov. Tswv yim yog siv los txais cov ntaub ntawv nyob rau hauv whereas Tso zis yog siv los xa cov ntaub ntawv tawm. Tso zis xa cov ntaub ntawv tawm los ntawm nthuav tawm cov khoom tsim tawm, feem ntau yog EventEmitter cov khoom.

Dhau li ntawd, @input thiab @output hauv angular 2 yog dab tsi?

Los ntawm Arvind Rai, Kaum Ib Hlis 24, 2016. Cov nplooj ntawv no yuav taug kev angular 2 @ Input thiab @Output piv txwv. @ Tswv yim yog ib tug decorator kos ib nkag khoom thiab @ Tso zis yog ib tug decorator kos ib tso zis vaj tse. @ Tswv yim yog siv los txhais ib qho nkag cov cuab yeej kom ua tiav cov khoom ntiag tug khi.

Tsis tas li ntawd, dab tsi yog input decorator hauv angular? Tswv yim (@ Tswv yim ()) yog ib qho ntawm feem ntau siv decorators nyob rau hauv Angular apps. Nws yog siv los hla cov ntaub ntawv los ntawm niam txiv lossis tus tswv tsev rau cov menyuam. Qhov no kho kom zoo nkauj muaj kev sib raug zoo nrog DOM cov cuab yeej nyob rau hauv template uas tus me nyuam tivthaiv siv.

Tom qab ntawd, dab tsi yog cov tswv yim thiab cov khoom tsim tawm hauv angular 4?

@ Tswv yim txuas cov cuab yeej ntawm ib feem (uas feem ntau yog cov khoom siv me nyuam) nrog tus nqi uas tau muab los ntawm lwm qhov (niam txiv). Ntawm qhov tod tes, tus @ Tso zis decorator yog siv los txuas cov khoom vaj khoom tsev ntawm cov menyuam yaus thiab emit nws los ntawm qhov kev tshwm sim emitter.

Dab tsi yog qhov tso zis tivthaiv?

Lub visually loj Input thiab Cov khoom tsim tawm sawv cev rau kev pabcuam HTTP thov thiab teb. Koj yuav tsum tso koj cov kev pabcuam logic nyob nruab nrab ntawm ob cov khoom . Input thiab Tso zis yog ob qho tshwj xeeb cov khoom ntawm Data Service REST txoj haujlwm. Cov tswv yim tiv thaiv muab koj cov kwj ntawm cov ntaub ntawv nkag.

Pom zoo: