Kev siv BrowserModule hauv angular yog dab tsi?
Kev siv BrowserModule hauv angular yog dab tsi?

Video: Kev siv BrowserModule hauv angular yog dab tsi?

Video: Kev siv BrowserModule hauv angular yog dab tsi?
Video: Kev siv tus yaj kuam yeeb kuam 2024, Kaum ib hlis
Anonim

Ib sab ntawm no, BrowserModule yog dab tsi hauv angular?

BrowserModule -Qhov browser module yog imported los ntawm @ lub kaum sab xis /platform-browser thiab nws yog siv thaum koj xav khiav koj daim ntawv thov hauv browser. CommonModule - Cov qauv sib txawv yog import los ntawm @ lub kaum sab xis / nquag thiab nws yog siv thaum koj xav siv cov lus qhia - NgIf, NgFor thiab lwm yam.

Ib sab saum toj no, dab tsi yog kev siv cov khoom nkag? Cov entryComponents array yog siv los txhais cov ntsiab lus uas tsis pom hauv html thiab tsim dynamically nrog ComponentFactoryResolver. Angular xav tau cov lus qhia no txhawm rau nrhiav lawv thiab sau ua ke. Tag nrho lwm cov khoom yuav tsum tsuas yog teev nyob rau hauv cov lus tshaj tawm array.

Nyob rau hauv no hais txog, dab tsi yog qhov kev siv ntawm ntau module nyob rau hauv angular?

CommonModule txuas. Exports tag nrho cov yooj yim Angular cov lus qhia thiab cov kav dej, xws li NgIf, NgForOf, DecimalPipe, thiab lwm yam. Rov xa tawm los ntawm BrowserModule, uas suav nrog hauv paus AppModule thaum koj tsim ib lub app tshiab nrog CLI cov lus txib tshiab.

Dab tsi yog import hauv angular?

Ib ntshuam yog qhov koj muab tso rau hauv imports cov cuab yeej ntawm @NgModule decorator. Nws enables ib Angular module siv functionality uas tau txhais nyob rau hauv lwm yam Angular module. Ib qho kev xa tawm uas koj tso yog cov khoom xa tawm ntawm @NgModule decorator.

Pom zoo: