Standalone Components
Standalone components, imports, providers, bootstrapping, การย้ายจาก NgModules, โครงสร้างแอปพลิเคชันใหม่
1Standalone component ใน Angular คืออะไร?
Standalone component ใน Angular คืออะไร?
คำตอบ
Standalone component คือ Angular component ที่กำหนด standalone: true ใน @Component decorator ของมัน สิ่งนี้ทำให้ component สามารถจัดการ imports และ providers ของตัวเองได้โดยไม่ต้องใช้ NgModule Standalone components ทำให้สถาปัตยกรรมง่ายขึ้นโดยกำจัดความจำเป็นในการมีโมดูลกลางสำหรับจัดระเบียบ dependencies
2จะประกาศ standalone component อย่างไร?
จะประกาศ standalone component อย่างไร?
คำตอบ
ในการสร้าง standalone component เพียงเพิ่มคุณสมบัติ standalone: true ใน @Component decorator การประกาศแบบง่ายนี้ทำให้ component เป็นอิสระจาก NgModule ใดๆ และอนุญาตให้จัดการ imports และ providers โดยตรงใน metadata ของ component ทำให้ไม่จำเป็นต้องประกาศภายนอกในโมดูล
3จะ import component อื่นเข้าไปใน standalone component อย่างไร?
จะ import component อื่นเข้าไปใน standalone component อย่างไร?
คำตอบ
ใน standalone component, dependencies (components, directives, pipes) จะถูกเพิ่มโดยตรงในอาร์เรย์ imports ของ @Component decorator แต่ละ component สามารถ import standalone components อื่นๆ, directives, pipes หรือแม้แต่ NgModules แบบดั้งเดิม สิ่งนี้กำจัดความจำเป็นในการมี NgModules กลางสำหรับจัดการ dependencies ระหว่าง components และทำให้สถาปัตยกรรมง่ายขึ้น
ใช้ฟังก์ชันใดในการ bootstrap แอปพลิเคชันด้วย standalone component?
จะกำหนดค่า providers ระดับโลกด้วย bootstrapApplication อย่างไร?
+15 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ Angular อื่นๆ
พื้นฐาน TypeScript
TypeScript ขั้นสูง
พื้นฐาน Angular
คอมโพเนนต์และวงจรชีวิต
Services & Dependency Injection
การจัดระเบียบโมดูล Angular
Angular CLI
Directives และ Pipes
Routing และการนำทาง
Reactive Forms
Template-driven Forms
พื้นฐาน RxJS
Operator ของ RxJS
HttpClient และการเรียก API
การจัดการ state พื้นฐาน
Change Detection
Angular Signals
การทำ Unit Testing ใน Angular
การทดสอบ End-to-End
Build และการเพิ่มประสิทธิภาพ
พื้นฐาน NgRx
NgRx ขั้นสูง
สถาปัตยกรรม Angular
การปรับแต่งประสิทธิภาพ
ความปลอดภัยและแนวทางปฏิบัติที่ดี
รูปแบบ RxJS ขั้นสูง
Angular Universal และ SSR
Angular Micro-frontends
เชี่ยวชาญ Angular สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี