Angular

Standalone Components

Standalone components, imports, providers, bootstrapping, การย้ายจาก NgModules, โครงสร้างแอปพลิเคชันใหม่

18 คำถามสัมภาษณ์·
Mid-Level
1

Standalone component ใน Angular คืออะไร?

คำตอบ

Standalone component คือ Angular component ที่กำหนด standalone: true ใน @Component decorator ของมัน สิ่งนี้ทำให้ component สามารถจัดการ imports และ providers ของตัวเองได้โดยไม่ต้องใช้ NgModule Standalone components ทำให้สถาปัตยกรรมง่ายขึ้นโดยกำจัดความจำเป็นในการมีโมดูลกลางสำหรับจัดระเบียบ dependencies

2

จะประกาศ standalone component อย่างไร?

คำตอบ

ในการสร้าง standalone component เพียงเพิ่มคุณสมบัติ standalone: true ใน @Component decorator การประกาศแบบง่ายนี้ทำให้ component เป็นอิสระจาก NgModule ใดๆ และอนุญาตให้จัดการ imports และ providers โดยตรงใน metadata ของ component ทำให้ไม่จำเป็นต้องประกาศภายนอกในโมดูล

3

จะ import component อื่นเข้าไปใน standalone component อย่างไร?

คำตอบ

ใน standalone component, dependencies (components, directives, pipes) จะถูกเพิ่มโดยตรงในอาร์เรย์ imports ของ @Component decorator แต่ละ component สามารถ import standalone components อื่นๆ, directives, pipes หรือแม้แต่ NgModules แบบดั้งเดิม สิ่งนี้กำจัดความจำเป็นในการมี NgModules กลางสำหรับจัดการ dependencies ระหว่าง components และทำให้สถาปัตยกรรมง่ายขึ้น

4

ใช้ฟังก์ชันใดในการ bootstrap แอปพลิเคชันด้วย standalone component?

5

จะกำหนดค่า providers ระดับโลกด้วย bootstrapApplication อย่างไร?

+15 คำถามสัมภาษณ์

หัวข้อสัมภาษณ์ Angular อื่นๆ

พื้นฐาน TypeScript

Junior
25 คำถาม

TypeScript ขั้นสูง

Junior
20 คำถาม

พื้นฐาน Angular

Junior
20 คำถาม

คอมโพเนนต์และวงจรชีวิต

Junior
20 คำถาม

Services & Dependency Injection

Junior
20 คำถาม

การจัดระเบียบโมดูล Angular

Mid-Level
22 คำถาม

Angular CLI

Junior
18 คำถาม

Directives และ Pipes

Mid-Level
22 คำถาม

Routing และการนำทาง

Mid-Level
24 คำถาม

Reactive Forms

Mid-Level
26 คำถาม

Template-driven Forms

Mid-Level
16 คำถาม

พื้นฐาน RxJS

Mid-Level
22 คำถาม

Operator ของ RxJS

Mid-Level
24 คำถาม

HttpClient และการเรียก API

Mid-Level
22 คำถาม

การจัดการ state พื้นฐาน

Mid-Level
20 คำถาม

Change Detection

Mid-Level
20 คำถาม

Angular Signals

Mid-Level
20 คำถาม

การทำ Unit Testing ใน Angular

Mid-Level
22 คำถาม

การทดสอบ End-to-End

Mid-Level
18 คำถาม

Build และการเพิ่มประสิทธิภาพ

Mid-Level
20 คำถาม

พื้นฐาน NgRx

Senior
24 คำถาม

NgRx ขั้นสูง

Senior
24 คำถาม

สถาปัตยกรรม Angular

Senior
22 คำถาม

การปรับแต่งประสิทธิภาพ

Senior
22 คำถาม

ความปลอดภัยและแนวทางปฏิบัติที่ดี

Senior
20 คำถาม

รูปแบบ RxJS ขั้นสูง

Senior
22 คำถาม

Angular Universal และ SSR

Senior
20 คำถาม

Angular Micro-frontends

Senior
20 คำถาม

เชี่ยวชาญ Angular สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี