You are previewing AngularJS Essentials.
O'Reilly logo
AngularJS Essentials

Book Description

Design and construct reusable, maintainable, and modular web applications with AngularJS

In Detail

This book is a practical guide filled with real-world examples that will help you discover the best practices of the AngularJS framework, covering its most important concepts such as directives, expressions, filters, and modules and guiding you through the steps of building your very own web application.

You will start by learning how to create reusable components with directives, experiencing an expressive way of developing software. Then we will move on to cover data handling, and you will learn how to use the various features of the AngularJS framework to accomplish any challenge related to presenting, transforming, and validating data on a user's interface.

After that, we will explore the secrets of the dependency injection mechanism available in AngularJS, bringing reuse and testability to your application by decoupling the layers. The book will also cover the best practices of using the framework and how to automate the test and the project's workflow.

What You Will Learn

  • Create reusable components with directives
  • Explore filters to manipulate and transform data
  • Discover more about the two-way data binding mechanism
  • Easily validate data from the user's form
  • Create services in order to keep the business logic under control
  • Understand and explore the dependency injection feature
  • Follow the best practices of the framework to organize and modularize your application
  • Automate your project's workflow and learn everything you need to know about unit testing with AngularJS
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. AngularJS Essentials
      1. Table of Contents
      2. AngularJS Essentials
      3. Credits
      4. About the Author
      5. Acknowledgments
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Getting Started with AngularJS
        1. Introduction to AngularJS
        2. Architectural concepts
        3. Setting up the framework
        4. Organizing the code
          1. Four ways to organize the code
            1. The inline style
            2. The stereotyped style
            3. The specific style
            4. The domain style
        5. Summary
      10. 2. Creating Reusable Components with Directives
        1. What is a directive?
        2. Using AngularJS built-in directives
          1. The ngApp directive
          2. The ngController directive
            1. Nested controllers
          3. The ngBind directive
          4. The ngBindHtml directive
          5. The ngRepeat directive
          6. The ngModel directive
          7. The ngClick directive and other event directives
          8. The ngDisable directive
          9. The ngClass directive
          10. The ngOptions directive
          11. The ngStyle directive
          12. The ngShow and ngHide directives
          13. The ngIf directive
          14. The ngInclude directive
        3. Refactoring application organization
        4. Creating our own directives
          1. template
          2. templateUrl
          3. replace
          4. restrict
          5. scope
          6. transclude
          7. link
          8. require
          9. controller
          10. compile
        5. Animation
          1. How it works?
          2. Animating ngRepeat
          3. Animating ngHide
          4. Animating ngClass
        6. Summary
      11. 3. Data Handling
        1. Expressions
        2. Filters
          1. Basic usage with expressions
            1. currency
            2. date
            3. filter
            4. json
            5. limitTo
            6. lowercase
            7. number
            8. orderBy
            9. uppercase
          2. Using filters in other places
          3. Creating filters
        3. Form validation
          1. Creating our first form
          2. Basic validation
          3. Understanding the $pristine and $dirty properties
          4. The $error object
        4. Summary
      12. 4. Dependency Injection and Services
        1. Dependency injection
        2. Creating services
          1. Creating services with the factory
          2. Creating services with the service
          3. Creating services with the provider
        3. Using AngularJS built-in services
          1. Communicating with the backend
            1. HTTP, REST, and JSON
              1. AJAX
            2. Creating an HTTP facade
            3. Headers
            4. Caching
            5. Interceptors
          2. Creating a single-page application
            1. Installing the module
            2. Configuring the routes
            3. Rendering the content of each view
            4. Passing parameters
            5. Changing the location
            6. Resolving promises
          3. Logging
          4. Timeout
          5. Asynchronous with a promise-deferred pattern
            1. The deferred API
            2. The promise API
        4. Summary
      13. 5. Scope
        1. Two-way data binding
          1. $apply and $watch
        2. Best practices using the scope
        3. The $rootScope object
        4. Scope Broadcasting
        5. Summary
      14. 6. Modules
        1. Creating modules
          1. The UI module
          2. The search module
          3. The parking application module
        2. Recommended modules
        3. Summary
      15. 7. Unit Testing
        1. The Jasmine testing framework
        2. Testing AngularJS components
          1. Services
          2. Controllers
          3. Filters
          4. Directives
            1. Creating the element with the directive
            2. Compiling the directive
            3. Calling the link function with the scope
            4. Invoking the digest cycle
          5. Mocking with $httpBackend
          6. Running tests with Karma
            1. Installation
            2. Configuration
            3. Running tests
        3. Summary
      16. 8. Automating the Workflow
        1. Automating the workflow with Grunt
          1. Installation
          2. Configuration
          3. Creating a distribution package
          4. Executing the workflow
        2. Managing packages with Bower
          1. Installation
          2. Finding packages
          3. Installing packages
          4. Using packages
          5. Cache
        3. Summary
      17. Index