Skip to content
CodingThailand's Blog
CodingThailand's Blog

by โค้ชเอก

  • Home
  • About Me
  • CodingThailand.com
CodingThailand's Blog

by โค้ชเอก

เรื่องเล่า Angular 2 (RC5)

31/08/201631/08/2016

ag2

สำหรับคนที่ตาม Angular 2 อยู่ ตอนนี้เป็นเวอร์ชัน RC5 (2.0.0-rc.5) ครับ

ใน RC5 นี้ได้เพิ่ม features ที่สำคัญมาก ได้แก่ Angular Modules (@NgModule)การมาของ Angular Modules ทำให้ angular libraies หลายๆตัวจะเริ่มทยอยกลายเป็น modules ครับ ไม่ว่าจะเป็น FormsModule, HttpModule, RouterModule เป็นต้น ทำให้โค้ดที่เคยเขียนต้องเขียนใหม่หลายจุดเลยทีเดียว
เช่นเดียวกันครับ พวก third party libraries ทั้งหลายก็จะเป็นกลายเป็น Modules เหมือนกัน เช่น Meterial Design, Ionic, AngularFire2 (Firebase) เป็นต้น
ข้อดีของ Angular Modules จะทำให้โค้ดในแต่ละ component ของเราดูสั้นลง สะอาด และอ่านง่ายขึ้น เพราะเราสามารถ import คลาส, Services หรือ Modules ต่างๆ เข้ามาได้ตั้งแต่ app เริ่มทำงานเลย ทำให้ component ที่เราเขียนไม่ต้อง import อะไรซ้ำๆ และนำไปใช้ได้ทันทีจากนี้ไปในทุกๆ App ที่เขียนด้วย Angular 2 จะมี root module ครับ หรือเรียกอีกอย่างหนึ่งว่า AppModule ก็ได้ อย่างน้อย 1 ตัวเสมอ (ในไฟล์ app.module.ts)

อีกอันหนึ่งที่มาใหม่คือ โหมด Just in Time (JIT) Compilation ที่จะช่วยให้เรา compile component และ modules ต่างๆได้ไวขึ้นขณะที่เรากำลังพัฒนา app อยู่ (development mode) และที่คู่กันคือโหมด Ahead of Time (AOT) Compilation ที่ช่วยเพิ่มประสิทธิภาพ และช่วยให้ app ของเราทำงานไวขึ้นมาก อันนี้แนะนำให้ใช้ตอนเป็น production mode

 

ตอนขึ้น production ก็อย่าลืมเปลี่ยนโหมด และ enable production กันด้วยนะครับ 🙂

ถามว่า Angular 2 จะออกตัวจริงเมื่อไหร่? การมาของ RC5 แสดงให้เห็นว่าคงใกล้มากๆแล้วครับ (เห็นบอกไม่กี่สัปดาห์)

ไว้มีอะไรใหม่ๆจะมาเล่าให้ฟังกันอีก

Views: 376

Angular 2 Angular 2

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Posts ล่าสุด

  • การใช้งาน Prefetching ใน Next.js
  • 14 ข้อคิด เพื่อการเป็น Developer ที่ดีขึ้น จาก “Lee Robinson”
  • เคยเจอ “TypeError: Cannot read property ‘x’ of undefined” หรือเปล่า
  • บันทึกการเขียนเว็บไซต์ใหม่ในรอบ 10 ปี ย้ายมาใช้ Next.js
  • ทำไมการจัดการ Error ใน JavaScript ถึงเป็นเรื่องท้าทาย?

Recent Comments

    หมวดหมู่

    • .NET
    • AI
    • Android
    • Angular
    • Angular 2
    • Coding
    • CSS
    • Database
    • Editor
    • Flutter
    • Git
    • HTML5
    • Ionic 2
    • Ionic 4
    • Ionic Framwork
    • JavaScript
    • Laravel
    • Laravel 5
    • Next.js
    • Node.js
    • PHP
    • PHP 7
    • Plugins
    • React
    • React Native
    • Template
    • Tools
    • TypeScript
    • UI
    • Uncategorized
    • Vue.js
    • XAMPP
    • Yii
    • คอร์สเรียน
    • แรงบันดาลใจ

    Archives

    • July 2025
    • April 2025
    • November 2024
    • October 2024
    • April 2020
    • February 2020
    • August 2019
    • September 2018
    • August 2018
    • February 2018
    • November 2017
    • October 2017
    • August 2017
    • July 2017
    • April 2017
    • October 2016
    • August 2016
    • May 2016

    Tags

    .NET android Angular Angular 2 Atom Coding Coding Standard CSS CSS 3 Datepicker Express.js extensions Git HTML HTML5 Ionic2 JavaScript Laravel5 laravel 5.5 MariaDB Material Design MySQL Node.js npm PHP PHP7 plugins PouchDB recaptcha Restful sail.js template typescript typscript XAMPP Yii2

    ผู้เยี่ยมชม

    • 0
    • 1,818,146
    • 547,556
    • 376
    ©2025 CodingThailand's Blog | WordPress Theme by SuperbThemes