Dependency Injection with AngularJS

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.

Dependency Injection with AngularJS

Alex Knol

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.
Mapt Subscription
FREE
$29.99/m after trial
eBook
$12.60
RRP $17.99
Save 29%
Print + eBook
$29.99
RRP $29.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$12.60
$29.99
$29.99p/m after trial
RRP $17.99
RRP $29.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Code Files
Preview in Mapt

Book Details

ISBN 139781782166566
Paperback78 pages

Book Description

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.

The book contains a section that will show you how to make a chart component to display historical data. A short chapter will explain some of the theory and the reasons behind dependency injection. You will be introduced to Jasmine, a JavaScript behavior-driven development testing framework. You will learn how to test your code in real browsers using Karma, the lightning fast AngularJS test runner. Lastly the book will show you how to build reusable components you can stack on top of each other.

You will learn everything you need to know how to use dependency injection with AngularJS.

Table of Contents

Chapter 1: Learning to Fly
Let's get going
Adding a controller
What about routes?
Showing a list
Adding a filter
Chart directives
Summary
Chapter 2: Better Code
Wiring up the backend
Duplicating code
Angular service to the rescue
The theory behind Dependency Injection
Summary
Chapter 3: The Magic
Application flow
Different ways of injecting
Summary
Chapter 4: Testing
Test automation
Test your code, not the framework
Testing the parts
The Karma test runner
End-to-end testing
Summary
Chapter 5: Large Applications
Organizing your application
Organizing using dynamic teams
Nesting controllers
More powerful nesting
Application communication
Summary

What You Will Learn

  • 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

Authors

Table of Contents

Chapter 1: Learning to Fly
Let's get going
Adding a controller
What about routes?
Showing a list
Adding a filter
Chart directives
Summary
Chapter 2: Better Code
Wiring up the backend
Duplicating code
Angular service to the rescue
The theory behind Dependency Injection
Summary
Chapter 3: The Magic
Application flow
Different ways of injecting
Summary
Chapter 4: Testing
Test automation
Test your code, not the framework
Testing the parts
The Karma test runner
End-to-end testing
Summary
Chapter 5: Large Applications
Organizing your application
Organizing using dynamic teams
Nesting controllers
More powerful nesting
Application communication
Summary

Book Details

ISBN 139781782166566
Paperback78 pages
Read More

Read More Reviews

Recommended for You

Mastering Web Application Development with AngularJS Book Cover
Mastering Web Application Development with AngularJS
$ 26.99
$ 5.40
AngularJS Directives Book Cover
AngularJS Directives
$ 19.99
$ 2.00
AngularJS Web Application Development Blueprints Book Cover
AngularJS Web Application Development Blueprints
$ 29.99
$ 21.00
Software Testing with Visual Studio Team System 2008 Book Cover
Software Testing with Visual Studio Team System 2008
$ 29.99
$ 21.00
AngularJS UI Development Book Cover
AngularJS UI Development
$ 26.99
$ 18.90
Responsive Web Design with HTML5 and CSS3 Book Cover
Responsive Web Design with HTML5 and CSS3
$ 23.99
$ 4.80