Muaj plaub yam tseem ceeb: Chav tsev kho kom zoo nkauj, piv txwv li. @Component and @NgModule . Property decorators rau cov khoom hauv chav kawm, xws li. @Input thiab @Output. Method decorators rau txoj hauv kev hauv chav kawm, e.g. @HostListener.
Dab tsi yog tus dai kom zoo nkauj siv rau kev teeb tsa chav kawm?
Dab tsi yog tus dai kom zoo nkauj siv rau kev teeb tsa koj chav kawm module? @NgModule decorator yog siv rau kev teeb tsa koj chav module.
Tus kho kom zoo nkauj twg yog siv los txheeb xyuas cov chav kawm?
The parameter decorator yog siv rau kev ua haujlwm rau chav tsim qauv lossis kev tshaj tawm txoj kev. Ib tus neeg kho kom zoo nkauj tsis tuaj yeem siv rau hauv cov ntaub ntawv tshaj tawm, tshaj tawm, lossis lwm yam ntsiab lus ambient (xws li hauv chav tshaj tawm).
Tus kho kom zoo nkauj twg yog siv los muab cov ntaub ntawv meta rau hauv chav kawm?
. Component decorator tso cai rau koj kos ib chav kawm ua Angular tivthaiv thiab muab cov metadata ntxiv uas txiav txim siab seb cov khoom yuav tsum ua li cas, instantiated thiab siv thaum lub sijhawm ua haujlwm. Cov Cheebtsam yog qhov yooj yim tshaj plaws hauv tsev thaiv ntawm UI hauv daim ntawv thov Angular.
Dab tsi yog daig hauv angular6?
Decorator uas cim cov chav kawm ua Angular tivthaiv thiab muab cov txheej txheem metadata uas txiav txim siab yuav ua li cas cov khoom yuav tsum ua tiav, instantiated, thiab siv sijhawm.