O'Reilly logo

Mastering AngularJS Directives by Josh Kurz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Building a Stopwatch Directive

The stopwatch is a full-fledged example of how to build an AngularJS directive from start to finish. This chapter will cover the correct way to break down requirements and consolidate them into actionable items. We will explain how the directive API offers different ways to accomplish similar tasks and how to best choose what options accomplish tasks in the most efficient and readable manner.

The purpose of this chapter is to showcase simple and efficient techniques when writing directives. We do this by writing a stopwatch and showing how to accomplish its set of requirements. The stopwatch's definition object could be set up in different ways. We will first see how to create the stopwatch in its most ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required