Dependency Injection with AngularJS

Alex Knol

  • 出版商: Packt Publishing
  • 出版日期: 2013-12-21
  • 售價: $1,250
  • 貴賓價: 9.5$1,188
  • 語言: 英文
  • 頁數: 78
  • 裝訂: Paperback
  • ISBN: 1782166564
  • ISBN-13: 9781782166566
  • 相關分類: Angular
  • 下單後立即進貨 (約3~4週)

商品描述

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中使用相依性注入的所有知識。

從這本書中你將學到:
- 創建由組件之間獨立性推動的可重複使用的組件
- 使用Karma測試運行真實瀏覽器
- 設置Jasmine BDD測試
- 設置並安裝AngularJS
- 將耦合代碼轉換為鬆散耦合的注入相依性
- 使用Protractor創建集成測試
- 使用相依性注入組織大型應用程式

這本書是一本實用的、實踐性的指南,介紹了使用相依性注入和實施測試驅動開發的AngularJS。

這本書適合已經了解AngularJS但需要在實際應用中開始使用它的開發人員。同樣,想要使用AngularJS進行測試驅動開發的開發人員可以使用這本書作為實用指南。即使你已經了解相依性注入,它也可以作為在AngularJS中使用它的良好參考。讀者需要具備一些JavaScript經驗。