Free Sample
+ Collection

AngularJS Directives

Alex Vanston

Intermediate JavaScript developers could take a big step forward with this essential step-by-step tutorial to AngularJS directives. By the end you’ll be building dynamic web applications with multiple modules.
RRP $19.99
RRP $32.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783280339
Paperback110 pages

About This Book

  • Learn how to build an AngularJS directive
  • Create extendable modules for plug-and-play usability
  • Build apps that react in real time to changes in your data model

Who This Book Is For

This book is intended for intermediate JavaScript developers who are looking to enhance their understanding of single-page web application development with a focus on AngularJS and the JavaScript MVC frameworks.

It is expected that readers will understand basic JavaScript patterns and idioms and can recognize JSON formatted data.

Table of Contents

Chapter 1: Designing Web Applications in 2013
An overview of good code
We're not just talking about a lot of APIs
Data driven development
Chapter 2: The Need for Directives
What makes a directive a directive
Chapter 3: Deconstructing Directives
Getting started
Attachment styles
Configuration options
Chapter 4: Compile versus Link
Peeking under the covers
What about linking?
Chapter 5: Keeping it Clean with Scope
Scope = false
Scope = true
Scope = {}
Chapter 6: Controllers – Better with Sharing
Forms and inputs
Creating our own controller communication
Chapter 7: Transclusion
That's not a word... is a solution
Manipulating the transcluded content
Chapter 8: Good Karma – Testing in AngularJS
Getting Started
My first test
Mocking data
The test subject
E2E testing
Chapter 9: A Deeper Dive into Unit Testing
Highlighted, again
Negative testing
Chapter 10: Bringing it All Together
Angular content grid
Diving in
The initial directive
Connecting Masonry
Further steps

What You Will Learn

  • Craft a dynamic module that reflects data changes in real-time
  • Create an interconnected single-page application
  • Build third-party widgets
  • Consume existing content and integrate it into your directive
  • Integrate AngularJS with jQuery plugins
  • Communicate with other modules via messaging
  • Unit test your AngularJS directive
  • Set up and execute browser functionality tests with the Angular Scenario Runner

In Detail

AngularJS, propelled by Google, is quickly becoming one of the most popular JavaScript MVC frameworks available, working to invert the development paradigm and bring data-driven modularity to the web frontend. Directives serve as the core building blocks in AngularJS and enable you to create reusable models that mold around your data structures and breathe new life into the intersection of HTML and JavaScript.

AngularJS Directives serves as an in-depth study of some of the core features of AngularJS and provides you with all the knowledge you need to create fully dynamic web applications that respond in real-time to changes in data. You'll learn how to build directives from the ground up as well as some of the best practices for architecting them. By the end of this book, you'll be able to create a web application comprised of multiple modules all working together seamlessly to provide the best possible user experience.

AngularJS Directives starts by investigating the best practices for single-page application development overall before diving into how AngularJS directives fulfill those goals. At each step, you'll learn both the how and why of what we're building, and by the end, you'll not only know the facts necessary to create a directive, but you’ll also have the knowledge to decide how best to assemble it.

You'll also learn why it's best to build applications with the data-model as your foundation, how to craft new dynamic modules that communicate with each other, how to build widgets that can be embedded in third-party websites, and even how to create custom inputs so your users can intuitively interact with your data. In AngularJS Directives, you'll learn all the necessary tools to begin architecting your own directives and how to use them in the construction of a more dynamic Web.


Read More