Componentref yog dab tsi?
Componentref yog dab tsi?

Video: Componentref yog dab tsi?

Video: Componentref yog dab tsi?
Video: Yog hmoov dab tsi - Gao Nou Kue ft. Mang Vang (Official Music Video) New song 2020 2024, Kaum ib hlis
Anonim

ComponentRef chav kawm

Sawv cev ib qho piv txwv ntawm a Cheebtsam tsim los ntawm ComponentFactory. ComponentRef muab kev nkag mus rau lub Cheebtsam Piv txwv li thiab lwm yam khoom muaj feem xyuam rau qhov no Cheebtsam Piv txwv thiab tso cai rau koj los rhuav tshem cov Cheebtsam Piv txwv ntawm cov ComponentRef.

Tom qab ntawd, ib tus tuaj yeem nug, ViewContainerRef yog dab tsi?

Yog tias koj xav ntxig cov khoom tshiab lossis cov qauv, koj yuav tsum qhia Angular qhov twg los tso cov khoom no. Thiab qhov ntawd yog dab tsi ViewContainerRef yog: DOM lub caij (lub thawv) uas kuv tuaj yeem muab koj cov khoom tshiab los ua ib tus kwv tij rau lub caij no.

Ib yam li ntawd, dab tsi yog qhov dynamic tivthaiv hauv angular? Dynamic txhais tau tias, qhov cov khoom qhov chaw nyob rau hauv daim ntawv thov tsis tau txhais nyob rau hauv buildtime. Qhov ntawd txhais tau hais tias nws tsis siv nyob rau hauv ib qho twg lub kaum sab xis tus qauv. Es tsis txhob, lub tiv thaiv yog instantiated thiab muab tso rau hauv daim ntawv thov ntawm runtime.

Hais txog qhov no, ComponentFactory yog dab tsi hauv angular?

ComponentFactory txuas Base chav kawm rau lub Hoobkas uas tuaj yeem tsim cov khoom siv dynamically. Instantiate lub Hoobkas rau ib hom kev tivthaiv nrog dawsComponentFactory().

Dab tsi yog cov lus qhia hauv angular?

Angular cov lus qhia yog siv los txuas lub zog ntawm HTML los ntawm kev muab nws cov syntax tshiab. Txhua lus qhia muaj ib lub npe - los ntawm ib tug Angular predefined zoo li ng-repeat, lossis ib qho kev cai uas tuaj yeem hu ua dab tsi. Thiab txhua tus lus qhia txiav txim siab qhov twg nws tuaj yeem siv tau: hauv ib lub ntsiab lus, tus cwj pwm, chav kawm lossis cov lus pom.

Pom zoo: