AngularJS Directives

AngularJS Directives
eBook: $19.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $52.98    Print cover: $32.99
save 38%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 110 pages [ 235mm x 191mm ]
Release Date : September 2013
ISBN : 1783280336
ISBN 13 : 9781783280339
Author(s) : Alex Vanston
Topics and Technologies : All Books, Web Development, Open Source

Table of Contents

Chapter 1: Designing Web Applications in 2013
Chapter 2: The Need for Directives
Chapter 3: Deconstructing Directives
Chapter 4: Compile versus Link
Chapter 5: Keeping it Clean with Scope
Chapter 6: Controllers – Better with Sharing
Chapter 7: Transclusion
Chapter 8: Good Karma – Testing in AngularJS
Chapter 9: A Deeper Dive into Unit Testing
Chapter 10: Bringing it All Together
    • Chapter 2: The Need for Directives
      • What makes a directive a directive
        • Directives are declarative
        • Directives are data driven
        • Directives are conversational
        • Directives are everything you've dreamed about
      • Summary
      • Chapter 3: Deconstructing Directives
        • Getting started
          • With Angular
          • With directives
        • Naming
        • Attachment styles
        • Configuration options
          • Priority
          • Terminal
          • Templating
          • Replace
          • Compiling and linking
          • Scope
          • Controllers
          • Transclusion
      • Summary

                      Alex Vanston

                      Alex Vanston is a self-professed geek and an outdoor junkie fused together. During high-school he began teaching himself how to code and has been obsessed with learning new languages and better ways to solve problems ever since. He has been building web sites and applications professionally for the past seven years, for clients and companies around the world. Currently he lives in Denver, CO, where he loves hiking (5 14ers down, 49 to go), playing pickup sports, and water skiing when he can. He's the lead front-end developer for ZipKick, Inc, a travel startup taking off in San Francisco, CA. You can find him online at, where he blogs about web development and tech.

                      Code Downloads

                      Download the code and support files for this book.

                      Submit Errata

                      Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                      - 1 submitted: last submission 03 Jun 2014

                      Errata Type: Code | Page no: 24

                      Given code is:

                      angular.directive('myAwesomeDirective', function () {
                      return {
                      compile : function (tElement, tAttrs, transclude) {
                      pre : function compile ($scope, $element, $attrs) {},
                      post : function link ($scope, $element, $attrs) {}
                      ...//current pre and post text

                      But the code should be as follows:

                      angular.directive('myAwesomeDirective', function () {
                      return {
                      compile : function (tElement, tAttrs, transclude) {
                      pre : function compile ($scope, $element, $attrs) {},
                      post : function link ($scope, $element, $attrs) {}


                      Sample chapters

                      You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                      Frequently bought together

                      AngularJS Directives +    Mastering Web Application Development with AngularJS =
                      50% Off
                      the second eBook
                      Price for both: €26.35

                      Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                      What you will learn from this book

                      • 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.


                      This book uses a practical, step-by-step approach, starting with how to build directives from the ground up before moving on to creating web applications comprised of multiple modules all working together to provide the best user experience possible.

                      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.

                      Code Download and Errata
                      Packt Anytime, Anywhere
                      Register Books
                      Print Upgrades
                      eBook Downloads
                      Video Support
                      Contact Us
                      Awards Voting Nominations Previous Winners
                      Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                      Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software