Dab tsi yog host element hauv angular?
Dab tsi yog host element hauv angular?

Video: Dab tsi yog host element hauv angular?

Video: Dab tsi yog host element hauv angular?
Video: Yuav ncaim lawm es koj xav li cas?. 9/23/2017 2024, Tej zaum
Anonim

Tus tswv tsev . tig ib Angular tivthaiv rau hauv ib yam dab tsi ua rau hauv DOM koj yuav tsum koom nrog ib qho Angular tiv thaiv nrog DOM keeb . Peb hu xws li cov khoom hostess . Ib feem tuaj yeem cuam tshuam nrog nws tus tswv tsev DOM keeb raws li hauv qab no: Nws tuaj yeem mloog nws cov xwm txheej.

Ib yam li ntawd, koj tuaj yeem nug, dab tsi yog tus tswv hauv angular?

Hauv Angular : tus tswv tsev ,: tus tswv tsev -Cov ntsiab lus, thiab / sib sib zog nqus / selectors yog siv nyob rau hauv cov khoom uas nyob rau hauv niam txiv kev sib raug zoo me nyuam. Qhov: tus tswv tsev selector hauv Angular tivthaiv plays lub luag haujlwm los siv cov qauv rau tus tswv tsev keeb. Los ntawm lub neej ntawd kev tivthaiv style ua haujlwm hauv nws cov qauv qauv.

Qhov thib ob, HostListener thiab HostBinding yog dab tsi? @ HostBinding thiab @ HostListener yog ob lub decorators hauv Angular uas tuaj yeem pab tau tiag tiag hauv cov lus qhia kev cai. @ HostBinding tso cai rau koj teeb tsa cov khoom ntawm cov khoom lossis cov khoom siv uas tuav cov lus qhia, thiab @ HostListener cia koj mloog cov xwm txheej ntawm tus tswv tsev lossis cov khoom siv.

Kuj paub yog, dab tsi yog Ng tob hauv angular?

:: ng - tob selector Siv lub:: ng - tob duab ntxoov ntxoo-piercing xeeb leej xeeb ntxwv combinator kom yuam ib tug style los ntawm tus me nyuam tivthaiv tsob ntoo mus rau tag nrho cov me nyuam tivthaiv views. Qhov:: ng - tob combinator ua haujlwm rau txhua qhov tob ntawm cov khoom sib txuas, thiab nws siv rau ob qho tib si saib cov menyuam yaus thiab cov menyuam cov ntsiab lus ntawm cov khoom.

Dab tsi yog host context?

tus tswv tsev - ntsiab lus yog siv los tsim cov ntsiab lus hauv ib qho kev tivthaiv, nyob ntawm qee qhov xwm txheej sab nraud ntawm nws.

Pom zoo: