Dependency Injection with AngularJS
暫譯: 使用 AngularJS 的依賴注入
Alex Knol
- 出版商: Packt Publishing
- 出版日期: 2013-12-21
- 售價: $1,360
- 貴賓價: 9.5 折 $1,292
- 語言: 英文
- 頁數: 78
- 裝訂: Paperback
- ISBN: 1782166564
- ISBN-13: 9781782166566
-
相關分類:
Angular
海外代購書籍(需單獨結帳)
商品描述
If you want to start using AngularJS for real, this is the book you need. Its down-to-earth practical approach will quickly teach you all you need to know about dependency injection utilizing this versatile framework.
Overview
- Understand the concept of dependency injection
- Isolate units of code during testing JavaScript using Jasmine
- Create reusable components in AngularJS
In Detail
Dependency injection facilitates better testing by allowing us to mock dependencies in testing environments so that we only test one thing at a time. It also enables us to write more maintainable code by decoupling our objects from their implementations. The motivation for using it in AngularJS is to make it easier to transparently load mocked objects in tests.
This book is a practical manual to get you started on dependency injection. It will also take you along the road to creating testable and reusable code. Ensuring productivity and stability are the two most important things that you will learn.
"Dependency Injection with AngularJS" will introduce you to AngularJS using a simple sample project. By portraying different ways of developing code modules, it will show you the advantages of dependency injection. This will lead to the ability to create reusable components that can easily be tested.
You will learn everything you need to know how to use dependency injection with AngularJS.
What you will learn from this book
- Create reusable components propelled by the independence of components from each other
- Run tests on real browsers using the Karma test runner
- Set up Jasmine BDD testing
- Set up and install AngularJS
- Change coupled code to loosely coupled injected dependencies
- Create integration tests using Protractor
- Organize large applications using dependency injection
Approach
This book is a practical, hands-on approach to using dependency injection and implementing test-driven development using AngularJS.
Who this book is written for
Dependency Injection with AngularJS is aimed at developers who are aware of AngularJS but need to get started with using it in real life applications. Also, developers who want to get into test-driven development with AngularJS can use this book as practical guide. Even if you know about dependency injection, it can serve as a good reference on how it is used within AngularJS. Readers are expected to have some experience with JavaScript.
商品描述(中文翻譯)
如果你想真正開始使用 AngularJS,這是你需要的書籍。它務實的實用方法將迅速教會你有關使用這個多功能框架的依賴注入所需的所有知識。
**概述**
- 理解依賴注入的概念
- 在使用 Jasmine 測試 JavaScript 時隔離代碼單元
- 在 AngularJS 中創建可重用的組件
**詳細內容**
依賴注入通過允許我們在測試環境中模擬依賴來促進更好的測試,這樣我們一次只測試一件事。它還使我們能夠編寫更易於維護的代碼,通過將對象與其實現解耦。在 AngularJS 中使用它的動機是使在測試中透明地加載模擬對象變得更容易。
這本書是一本實用手冊,幫助你入門依賴注入。它還將引導你創建可測試和可重用的代碼。確保生產力和穩定性是你將學到的兩個最重要的事情。
《使用 AngularJS 的依賴注入》將通過一個簡單的示例項目向你介紹 AngularJS。通過描繪不同的代碼模塊開發方式,它將展示依賴注入的優勢。這將使你能夠創建可以輕鬆測試的可重用組件。
本書包含一個部分,將向你展示如何製作一個顯示歷史數據的圖表組件。一個簡短的章節將解釋一些理論及其背後的原因。你將接觸到 Jasmine,一個基於行為的 JavaScript 開發測試框架。你將學習如何使用 Karma,這個快速的 AngularJS 測試運行器,在真實瀏覽器中測試你的代碼。最後,本書將向你展示如何構建可以相互堆疊的可重用組件。
你將學到使用 AngularJS 的依賴注入所需的所有知識。
**你將從這本書中學到什麼**
- 創建由組件之間的獨立性推動的可重用組件
- 使用 Karma 測試運行器在真實瀏覽器中運行測試
- 設置 Jasmine BDD 測試
- 設置和安裝 AngularJS
- 將耦合代碼更改為鬆耦合的注入依賴
- 使用 Protractor 創建集成測試
- 使用依賴注入組織大型應用程序
**方法**
這本書是一種實用的、動手的方式來使用依賴注入並使用 AngularJS 實施測試驅動開發。
**本書的讀者對象**
《使用 AngularJS 的依賴注入》旨在針對那些了解 AngularJS 但需要在實際應用中開始使用它的開發人員。此外,想要進入 AngularJS 測試驅動開發的開發人員也可以將本書作為實用指南。即使你已經了解依賴注入,它也可以作為一個良好的參考,說明它在 AngularJS 中的使用方式。讀者預期對 JavaScript 有一定的經驗。