ฝึก Angular 4:ตอนที่ 5 index.html
Aug 27, 2017 · 1 min read
ทุกครั้งที่เปิดเว็บไซด์ http://localhost:4200 ไฟล์ index.html จะถูกเรียกใช้ ซึ่งมีโครงสร้างดังนี้
<!doctype html>
<html lang=”en”>
<head>
<meta charset=”utf-8">
<title>MyApp</title>
<base href=”/”><meta name=”viewport” content=”width=device-width, initial-scale=1">
<link rel=”icon” type=”image/x-icon” href=”favicon.ico”>
</head>
<body>
<app-root></app-root>
</body>
</html>
จะสังเกตเห็นว่า index.html คือหนึ่ง page view นั้นเอง
คือมี tag <html></html>,<head></head> และ <body></body>
และ <app-root></app-root> คือชื่อ selector ของ component app.module.ts นั่นเอง
