by Dan Wellman
Lessons:2Length:14 minutes

For full access to all 2 lessons, including source files, subscribe with Elements.
- Overview
- Transcript
1.2 Testing Angular Controllers
In this lesson, we’ll take an existing Angular app and add tests for its controller. You’ll see how to create a new scope and how to create an instance of the controller and associate it with that scope. We’ll also see how to inject dependencies and how to stub methods in dependencies.
Code Snippet
beforeEach(inject(function ($controller) { sandbox.stub(localStorageService, 'supportsStorage').returns(false); $controller('notesController', { $scope: $scope }); }));
Related Links
1.Testing Angular Controllers2 lessons, 13:31
2 lessons, 13:31
Free Lesson 1.1Introduction01:27
Free Lesson
1.1
Introduction
01:27
1.2Testing Angular Controllers12:04
1.2
Testing Angular Controllers
12:04
Continue watching with Elements
Continue watching with Elements