此文档分享了Angular 4在网站开发的最佳实践,包括使用Visual Studio Code与Angular CLI、推荐的扩展以及如何优化Angular应用绩效。探讨了变更检测策略、模块化应用及延迟加载等主题,并提供了具体代码示例和指令。此外,强调了遵循Angular风格指南和使用工具如source-map-explorer来提高开发效率与代码质量。
8. AngularJS
User Group Taiwan
樣板 指令 Alias 用法
Module ng g m my-module
Component ng g c my-new-component
Directive ng g d my-new-directive
Service ng g s my-new-service
Pipe ng g p my-new-pipe
Guard ng g g my-new-guard
Enum ng g e my-new-enum
Interface ng g i my-new-interface
Class ng g cl my-new-class
使用 Alias 快速建立元件
9. AngularJS
User Group Taiwan
--build-optimizer (Angular Build Optimizer)
• 可大幅減少 Bundle 後的檔案大小 (專案越大越明顯)
• 目前為實驗性功能 (需額外加上 --build-optimizer 選項)
• 建置過程會比 --prod 多出一倍時間
--named-chunks feat(@angular/cli): name lazy
• 讓延遲載入的子路由模組可用「模組名稱」當成檔名
• 預設在 dev 環境就是啟用的
• 這是 webpack v2.4.0 的新功能
關於 --dev 與 --prod builds 的預設值
• --dev vs --prod builds
體驗最新最酷的建置功能 ( ng build )
35. AngularJS
User Group Taiwan
http://angular.tw (Angular User Group Taiwan)
https://forum.angular.tw/ ( 台灣 Angular 技術論壇 )
Angular Extension Pack - Visual Studio Marketplace
Angular Best Practices - August 2017 Edition
Optimizing the Performance of Your Angular Apps
Best Practices - STEPHEN FLUIN - YouTube
angular-cli/build.md at 1.3.x · angular/angular-cli
相關連結
37. AngularJS
User Group Taiwan
The Will Will Web
記載著 Will 在網路世界的學習心得與技術分享
• http://blog.miniasp.com/
Will 保哥的技術交流中心 (臉書粉絲專頁)
• http://www.facebook.com/will.fans
Will 保哥的噗浪
• http://www.plurk.com/willh/invite
Will 保哥的推特
• https://twitter.com/Will_Huang
聯絡資訊
#21:Default
Default means that the change detector’s mode will be set to CheckAlways during hydration.
OnPush
OnPush means that the change detector’s mode will be set to CheckOnce during hydration.
#26:The problem is, because Angular needs to re-run your function in every change detection cycle, if the function performs expensive tasks, it can be costly.
Angular Guide - Pipes
https://angular.io/guide/pipes
#27:The problem is, because Angular needs to re-run your function in every change detection cycle, if the function performs expensive tasks, it can be costly.
Angular Guide - Pipes
https://angular.io/guide/pipes