ถ้าเทียบกับเขียนแบบ component
พอดีใช้ template bootstrap ที่ซับซ้อนมาพอทำเป็น component แล้ว เอามาใช้ไม่ถูกเลย
แถมพวก library อื่นๆเวลาจะทำ slider อีกเป็นต้น แทรก .js ยังไงหล่ะครับ

Hiring! บริษัทที่น่าสนใจ

Carmen Software company cover
Carmen Software
Hotel Financial Solutions
Next Innovation (Thailand) Co., Ltd. company cover
Next Innovation (Thailand) Co., Ltd.
We are web design with consulting & engineering services driven the future stronger and flexibility.
KKP Dime company cover
KKP Dime
KKP Dime บริษัทในเครือเกียรตินาคินภัทร
Kiatnakin Phatra Financial Group company cover
Kiatnakin Phatra Financial Group
Financial Service
Fastwork Technologies company cover
Fastwork Technologies
Fastwork.co เว็บไซต์ที่รวบรวม ฟรีแลนซ์ มืออาชีพจากหลากหลายสายงานไว้ในที่เดียวกัน
Thoughtworks Thailand company cover
Thoughtworks Thailand
Thoughtworks เป็นบริษัทที่ปรึกษาด้านเทคโนโยลีระดับโลกที่คว้า Great Place to Work 3 ปีซ้อน
Iron Software company cover
Iron Software
Iron Software is an American company providing a suite of .NET libraries by engineer for engineers.
CLEVERSE company cover
CLEVERSE
Cleverse is a Venture Builder. Our team builds several tech companies.
Nipa Cloud company cover
Nipa Cloud
#1 OpenStack cloud provider in Thailand with our own data center and software platform.
Bangmod Enterprise company cover
Bangmod Enterprise
The leader in Cloud Server and Hosting in Thailand.
CIMB THAI Bank company cover
CIMB THAI Bank
MOVING FORWARD WITH YOU - CIMB is the leading ASEAN Bank
Bangkok Bank company cover
Bangkok Bank
Bangkok Bank is one of Southeast Asia's largest regional banks, a market leader in business banking
MuvMi (Urban Mobility Tech Co.,Ltd.) company cover
MuvMi (Urban Mobility Tech Co.,Ltd.)
Shape the future of urban mobility towards affordable, clean, and safe solutions
T.N. Digital Solution Co., Ltd. company cover
T.N. Digital Solution Co., Ltd.
TNDS has been involving in every first move of banking’s major digital transformation.
KBTG - KASIKORN Business-Technology Group company cover
KBTG - KASIKORN Business-Technology Group
KBTG - "The Technology Company for Digital Business Innovation"
Siam Commercial Bank Public Company Limited company cover
Siam Commercial Bank Public Company Limited
"Let's start a brighter career future together"
Icon Framework co.,Ltd. company cover
Icon Framework co.,Ltd.
Global Standard Platform for Real Estate แพลตฟอร์มสำหรับธุรกิจอสังหาริมทรัพย์ครบวงจร มาตรฐานระดับโลก
REFINITIV company cover
REFINITIV
The Financial and Risk business of Thomson Reuters is now Refinitiv
H LAB company cover
H LAB
Re-engineering healthcare systems through intelligent platforms and system design.
The Gang Technology Co., Ltd. company cover
The Gang Technology Co., Ltd.
We're a Digital Agency that helps our customers transform their business into digital with ease.
LTMH company cover
LTMH
LTMH มุ่งเน้นการพัฒนาผลิตภัณฑ์ที่สามารถช่วยพันธมิตรของเราให้บรรลุเป้าหมาย
Seven Peaks company cover
Seven Peaks
We Drive Digital Transformation
Wisesight (Thailand) Co., Ltd. company cover
Wisesight (Thailand) Co., Ltd.
The Best Choice For Handling Social Media · High Expertise in Social Data · Most Advanced and Secure
MOLOG Tech company cover
MOLOG Tech
We are Modern Logistic Platform, Specialize in WMS, OMS and TMS.
Data Wow Co.,Ltd company cover
Data Wow Co.,Ltd
We enable our clients to realize increased productivity by solving their most complex issues by Data
LINE Company Thailand company cover
LINE Company Thailand
LINE, the world's hottest mobile messaging platform, offers free text and voice messaging + Call
LINE MAN Wongnai company cover
LINE MAN Wongnai
Join our journey to becoming No.1 food platform in Thailand

หมายถึงใน component จะไม่ใส่สคริปต์แต่เอาสคริปต์ไปใส่ไว้ template เหรอครับ? หรือยังไง?

  1. ถ้าเข้าใจไม่ผิดน่าจะหมายถึงการเขียน template html แยกออกมาเป็นไฟล html จาก component.ts หรือเปล่า ถ้าใช่ก็ไม่มีอะไรเลยครับแค่ทำให้ความสะดวกในการจัดการ และ readability ล้วนๆ
    ดูเพิ่มเติมที่ rule of one
  2. การเพิ่ม third party lib ใน angular ต้องเข้าใจเรื่อง typings ของ typescript สักหน่อย แต่ถ้าเอาแบบง่ายสุด ไปตรงนี้เลยครับ
    Global scripts
    3rd Party Library Installation

ดูๆแล้วน่าจะเพิ่งเริ่มจับ Angular แนะนำให้ลองทำตาม Tutorial ก่อนเอาถึงแค่บท 7 ก็พอ
แล้วก็อ่าน fundamental ไล่ไปเลยครับแต่ข้ามหัวข้อ architecture ไปเลยก็ได้ ไม่งั้นยิ่งทำเดี่ยวยิ่งเละครับ

และแนะนำให้อ่าน Stories describing how to do more with the CLI ด้วยครับ มีประโยชน์มากบางอันสำคัญแต่ไม่ได้เขียนไว้หน้าเว็บของ angular

Alphonse Sat, 15/09/2018 - 01:50

คือแบบนี้
ถ้าเขียนแบบ http://domain/index.html หรือไฟล์อื่นไปแบบ html จะมีข้อเสียอย่างไรบ้างเทียบกับเขียนแบบ
Http://Domain/page
ครับ
พอดีไม่ค่อยเจอเวปที่เขียนแบบแรกเลยมีปัญหาพวก securityรึเปล่า แต่ที่สนใจเพราะใช้ bootstrap ที่ซับซ้อนมากทำแบบแรกจะง่ายกว่ากันเยอะเลยครับ

Alphonse Sat, 15/09/2018 - 09:38

ถามต่อ ครับ
สามารถเขียนในรูปแบบ http://domain/index.html ให้เป็นแบบ Http://Domain/page ได้ยังไงครับ server ใช้ firebase ถ้าเหมือน apache จะเป็น mod_rewrite ใช่ไหมครับ

มันใช้ route ของ framework นั้นล่ะครับ
แต่ต้องมีเทคนิคกับ server นิดหน่อย คือถ้า 404 page not found ก็ให้ server เรียก index.html ส่งกลับไปแทน
ทีนี้ script ที่อยู่ใน index.html ก็จะเอา location ที่มัน not found ไป route อีกที

ที่เหลือจะออกแบบ route ให้มันบรรเจิดยังไงก็อยู่ที่คนเขียนแล้วล่ะครับ

ไม่เข้าใจคำถาม

แต่เดาว่าถามเกี่ยวกับ router ประมาณว่าจะไม้ใช่ router ของมัน แต่สร้าง .html แยกแต่ละหน้าใช่ไหมครับ

ถ้าใช่ ปัญหาก้คือทำ dynamic route ไม่ได้เช่น http://domain/article/1 = เรียกบทความ id 1 ที่เหลือคือไม่ค่อยมีใครทำกัน เพราะแบบแรกทำแล้วครอบคลุมกว่า เลยไม่รู้จะทำแยกหน้าทำไม ถ้ายากทำก้ต้องเขียน build tools เอาเอง กับถ้าแบบแยกหน้าดูแล code ยากกว่า เช่นถ้า component A ถูกใช้ในหน้า B และ C ถ้า component A ถูกแก้ต้องตามไป build B กับ C ใหม่ ประมาณนี้มั้งครับ

มันเขียนได้ทั้งหลายแบบครับ ขึ้นอยู่กับความถนัด แยกไฟล์ข้อดีคือมัน Maintenance ง่าย มันแยกส่วน Present ออกไปชัดเจนเลย ทำให้เวลาต้องแก้ไขคำ หรือแก้ไข Design มันกระทบน้อย หรืออาจจะให้ Designer แก้ไขเลยได้ รู้แค่ Tag Template ก็แก้ไขได้แล้ว

ส่วนเรื่องความเร็ว หรือ Security ไม่ต้องห่วงหรอกครับเวลามันจะเอาไปใช้งานมันจะ Build ใหม่จาก Type Script เป็น js อีกทีนึง เวลามันเรียกใช้งานก็เรียกจาก js ปรกติ

มันเขียนได้หลายแบบ

  • แบบไฟล์ HTML เป็น Page แล้วใช้ Type Script คุม
  • แบบไฟล์ HTML เป็น Page เขียนส่วนต่างๆ เป็น Component เป็น Type Script มาประกอบร่างกันอีกที
  • แบบไฟล์ HTML เป็น Page เขียนส่วนต่างๆ เป็น Component แยก View ของ Component เป็น HTML ก็ได้

ส่วน่ใหญ่ผมใช้แบบข้อ 2 เป็นหลัก เพราะข้อ 3 มันย่อยไปเวลาแก้ไไฟล์ทีมันหายาก ยิ่งตั้งชื่อไฟล์ไม่ดีหากันลืม จริงๆ แล้วคุณใช้ View เป็น Bootstrap เลยก็ได้นะ ถ้าไม่ถนัด Angular UI ถ้าคุณเข้าใจมันเพียงพอ มันทำได้อยู่แล้วเอา Bootstrap มาทำเป็น Component เลยยังได้

ยังอยู่มั้ยครับ

http://domain/index.html (อันนี้โครงสร้าง ก่อน MVC)

Http://Domain/page (อันนี้ โครงสร้างคือ MVC)

ก่อน MVC คือวาง file ไว้ใน directory แล้วเรียกผ่าน IIS หรือ Apache
MVC มีโครงสร้างของมัน ต้องวางตามที่กำหนด แล้ว ไปกำหนด Route Config เอา
สรุปคือ ต้องอ่าน หนังสือซักเล่ม เอาตรงปกเลยก็ MVC ซัก Version หนึ่ง ให้รู้โครงสร้างของ MVC ก่อนนะครับ ใจเย็นๆ