ฝึก Angular 4:ตอนที่ 2 สร้างโปรเจค

สิ่งที่ต้องเตรียมคือ

  • ชื่อโปรเจค จากตัวอย่างคือ my-app
  • Path ที่เก็บโปรเจค D:\Code Project\Angular4
  1. เปิด Command Line Window ขึ้นมา เพื่อสร้างโปรเจค

ไป Drive D:

ไป path ที่ต้องการเก็บ

จากนั้นสร้างโปรเจค ด้วยคำสั่ง

ng new my-app

ขั้นตอนนี้ใช้เวลาสักพัก…

เมื่อเสร็จแล้วจะมีโปรคเจ็คชื่อ my-app อยู่ใน Path ที่กำหนด

2. Run โปรเจค เพื่อให้เข้าผ่าน Web Site ได้

URL:http://localhost:4200

เริ่มต้นไป Path ที่เก็บ Project

จากนั้น Launch Project ด้วยคำสั่ง

ng serve

หากต้องการให้ Launch Project และเข้าเว็บให้อัตโนมัติ ให้ใช้คำสั่ง

ng serve — open

หากต้องการให้ Launch Project และเปลี่ยน Port จาก 4200 เป็น Port อื่น ให้ใช้คำสั่ง

ng serve —port เลขPortที่ต้องการ

จากตัวอย่าง ก็จะเข้าเว็บด้วย http://localhost:4201 และจะเป็นเว็บให้อัตโนมัติ

)

Start Learning Front End

Written by

เป็น back-end developer ที่อยากเรียนรู้ front-end :เขียน JAVA,PHP,C#,Android รักการปั่นจักรยานและการนอน

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade