Qhov txawv ntawm @ViewChild thiab @input yog dab tsi?
Qhov txawv ntawm @ViewChild thiab @input yog dab tsi?

Video: Qhov txawv ntawm @ViewChild thiab @input yog dab tsi?

Video: Qhov txawv ntawm @ViewChild thiab @input yog dab tsi?
Video: Plab Plab Ntswg..(Pluav Pluav Ntswg) Maiv Twm New Song 2023-2024 2024, Kaum ib hlis
Anonim

Cov qhov sib txawv ntawm @ Saib cov me nyuam thiab @ContentChildren yog qhov @ Saib cov me nyuam saib rau cov ntsiab lus hauv Duab Ntxoo DOM thaum @ContentChildren saib rau lawv hauv Light DOM.

Cov lus nug tseem yog, qhov txawv ntawm @ViewChild thiab @input yog dab tsi?

Cov qhov sib txawv ntawm @ Saib cov me nyuam thiab @ContentChildren yog qhov @ Saib cov me nyuam saib rau cov ntsiab lus hauv Duab Ntxoo DOM thaum @ContentChildren saib rau lawv hauv Light DOM.

Tsis tas li ntawd, ViewChild yog dab tsi? SaibChild txuas Property decorator uas teeb tsa cov lus nug saib. Tus ntsuas hloov pauv saib rau thawj lub ntsiab lus lossis cov lus qhia sib piv rau tus xaiv hauv qhov pom DOM. Yog tias qhov pom DOM hloov, thiab tus menyuam tshiab phim tus neeg xaiv, cov cuab yeej hloov kho.

Ib yam li ntawd, koj tuaj yeem nug, qhov txawv ntawm ViewChild () thiab ContentChild () yog dab tsi?

Ib qho kev qhia, cov khoom siv, thiab cov khoom uas yog ib feem ntawm cov qauv qauv yog nkag mus rau hauv SaibChild . Txawm li cas los xij, txhua lub ntsiab lus lossis cov khoom siv uas tau npaj sab hauv yog nkag mus ua Cov ntsiab lus me nyuam.

Koj siv ViewChild li cas?

@ SaibChild () decorator tuaj yeem siv tau kom tau txais thawj lub ntsiab lus lossis cov lus qhia sib piv tus xaiv los ntawm saib DOM. @ SaibChild () muab qhov piv txwv ntawm lwm cov khoom lossis cov lus qhia hauv niam txiv tivthaiv thiab tom qab ntawd niam txiv tivthaiv tuaj yeem nkag mus rau cov qauv thiab cov khoom ntawm cov khoom ntawd lossis cov lus qhia.