You are previewing AngularJS: Maintaining Web Applications.
O'Reilly logo
AngularJS: Maintaining Web Applications

Book Description

Get started with speed building AngularJS applications, and scale up to a full-stack web application, using the existing AngularJS framework without the trouble of migrating to Angular 2

About This Book

  • Follow the best practices of the framework to organize and modularize your application

  • Get to grips with Angular’s Model-View-Controller architecture

  • Create application modules with maximum reusability and extensibility

  • Structure and use AngularJS applications in your MEAN project in your MEAN project

  • Who This Book Is For

    This course is for people who want to discover how they can improve their current web applications with the existing version of Angular without having to worry much about migrating to AngularJS 2

    What You Will Learn

  • Install and set up the AngularJS framework

  • Create your own full-featured and robust AngularJS web apps

  • Create reusable directives and then extend the behavior of HTML on your web page

  • Optimize and maintain your web applications

  • Create more powerful full-stack web applications, that draw on the combined power of AngularJS, Node.js, MongoDB, and Express in the MEAN stack

  • In Detail

    The AngularJS course is a journey to help you improve and scale your current web applications with the existing version of Angular without having to worry about migration to Angular 2. The course is divided into four modules.

    The first part—AngularJS Essentials is like a practical guide, filled with many step-by-step examples that will lead you through the best practices of AngularJS. After a brief introduction, you will learn how to create reusable components with directives. You will then take a look at many data handling techniques, discover a complete set of technologies that are capable to accomplish any challenge related to present, transform, and validate data on the user's interface. Finally, you will discover the best way to deal with the scope and how to break up the application into separate modules, giving rise to reusable and interchangeable libraries.

    With this you've crossed a milestone and are about to enter the world of learning by example. In the next part—Learning AngularJS By Example, you will learn how to effectively build apps using the AngularJS platform. You will be building multiple apps on this platform ranging from simple ones to more complex ones. In this module, you will roll up your coding sleeves and create a serious AngularJS application by example – a rich featured workout app. Take the coding a step at a time at first, then once you’re coding a full app in this module, a lot of AngularJS will fall right into place for you.

    The third module—AngularJS Web Application Development Cookbook, will get you accustomed to the AngularJS concept armed with a solid understanding of how it works, insight into the best ways to wield it in real-world applications, and annotated code examples. It is a rich library of AngularJS coding solutions that you can use straight away in your own code projects.

    You are just a step away from completing this learning path of AngularJS. The name of the next part—MEAN Web Development itself assures that you are nearing the destination. The idea is simple with this part, you'll take MongoDB as the database, Express as the web framework, AngularJS as the frontend framework, and Node.js as the platform, and combine them together in a modular approach that will ensure the flexibility needed in modern software development. This is also your graduation to full-stack web development, which can open many new coding and career opportunities for you!

    Style and approach

    Get up to speed building AngularJS applications, then improve and scale full-stack web applications, using the existing AngularJS framework without the trouble of migrating to Angular 2

    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 code file.

    Table of Contents

    1. AngularJS
      1. Table of Contents
      2. AngularJS
      3. Meet Your Course Guide
      4. Course Structure
      5. Course Structure
      6. 1. Core Learning – AngularJS Essentials
        1. Lesson 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
        2. Lesson 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
        3. Lesson 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. Lesson 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
        5. Lesson 5: Scope
          1. Two-way data binding
            1. $apply and $watch
          2. Best practices using the scope
          3. The $rootScope object
          4. Scope Broadcasting
        6. Lesson 6: Modules
          1. Creating modules
            1. The UI module
            2. The search module
            3. The parking application module
          2. Recommended modules
      7. 2. Core Coding – AngularJS By Example
        1. Lesson 1: Building Our First App – 7 Minute Workout
          1. What is 7 Minute Workout?
            1. Downloading the codebase
          2. Code organization
            1. Organizing the JavaScript code
          3. The 7 Minute Workout model
          4. Adding app modules
          5. The app controller
            1. Dependency injection
              1. Dependency Injection 101
              2. Dependency injection in Angular
                1. Handling minification
                2. Dependency annotations
            2. Controller implementations
              1. Tracking the duration of an exercise using the $interval service
            3. Verifying the implementation
            4. Implementing exercise transitions
            5. Using $watch to watch the models changes
              1. Exploring $watch
              2. Implementing transitions using $watch
            6. Using the AngularJS Promise API for exercise transitions
              1. The basics of promises
          6. The 7 Minute Workout view
            1. Image path binding with ng-src
            2. Using ng-style with the Bootstrap progress bar
          7. Adding start and finish pages
            1. Understanding SPAs
              1. View layouts for SPAs using ng-view
              2. Defining 7 Minute Workout routes
              3. The config/run phase and module initialization
              4. View navigation in the controller using $location
              5. Working with the $location service
          8. Learning more about an exercise
            1. Adding descriptions and video panels
              1. Working with ng-include
              2. Working with ng-repeat
          9. Displaying the remaining workout time using filters
            1. Creating a seconds-to-time filter
              1. Understanding AngularJS filters
              2. Implementing the secondsToTime filter
          10. Adding the next exercise indicator using ng-if
        2. Lesson 2: More AngularJS Goodness for 7 Minute Workout
          1. Formatting the exercise steps
            1. Understanding ng-bind-html
            2. Using ng-bind-html with data of the exercise steps
          2. Tracking exercise progress with audio clips
            1. Implementing audio support
              1. Implementing WorkoutAudioController
              2. Exploring the audio synchronization issue
              3. AngularJS dirty checking and digest cycles
                1. Summarizing our learnings
              4. Fixing the next-up exercise's audio synchronization issue
          3. Pausing exercises
            1. Implementing pause/resume in WorkoutController
            2. Adding the view fragment for pausing/resuming
              1. Pausing/resuming overlays using mouse events
              2. Pausing/resuming overlays with plain CSS
              3. CSS class manipulation using ng-class
            3. Stopping audio on pause
            4. Using the keyboard to pause/resume exercises
          4. Enhancing the workout video panel
            1. Refactoring the video panel and controller
            2. Video playback in the pop-up dialog
              1. Integrating the ui.bootstrap modal dialog
          5. Animations with AngularJS
            1. AngularJS CSS animation
            2. AngularJS JavaScript animation
            3. Adding animation to 7 Minute Workout
            4. Workout history tracking using Angular services
            5. AngularJS services primer
              1. Creating AngularJS services
                1. Creating services with the constant and value services
                2. Creating services using a service
                3. Creating services with a factory service
                4. Creating services with a provider service
            6. Implementing workout history tracking
              1. The WorkoutHistoryTracker service
                1. Services and scopes
                2. Service implementation continued...
              2. Integrating the WorkoutHistoryTracker service with a controller
            7. Adding the workout history view
            8. AngularJS eventing
            9. Enriching history tracking with AngularJS eventing
            10. Persisting workout history in browser storage
            11. Filtering workout history
            12. Filtering and ordering using ng-repeat
              1. The filter object of AngularJS filters
              2. The AngularJS orderBy filter
              3. Special ng-repeat properties
        3. Lesson 3: Building Personal Trainer
          1. The Personal Trainer app – the problem scope
            1. Personal Trainer requirements
          2. The Personal Trainer model
            1. Sharing the workout model
            2. The model as a service
          3. The Personal Trainer layout
            1. The Personal Trainer navigation with routes
              1. Integrating left and top navigation
          4. Implementing the workout and exercise list
            1. WorkoutService as a workout and exercise repository
            2. Exercise and workout list controllers
            3. Exercise and workout list views
          5. Building a workout
            1. Building left nav
            2. Adding the WorkoutBuilderService service
            3. Adding exercises using exercise nav
            4. Implementing WorkoutDetailController
              1. Route resolving
              2. Resolving routes not found!
              3. Implementing WorkoutDetailController continued…
            5. Implementing the workout builder view
            6. AngularJS forms
              1. AngularJS form constructs
              2. The ng-model directive
                1. Using ng-model with input and textarea
                2. Using ng-model with select
              3. Controlling model updates with ng-model-options (Angular 1.3)
              4. ng-model – beyond data binding
              5. Understanding NgModelController
              6. Implementing a decimal-to-integer formatter and parser
              7. AngularJS validation
              8. The AngularJS model state
              9. Workout builder validation
                1. How validation works (pre-Angular 1.3)
                2. How validation works (Angular 1.3)
                3. Managing validation error messages with ng-messages (Angular 1.3)
              10. Custom validation for an exercise count
              11. Saving the workout
            7. The AngularJS form directive and form validation
              1. The FormController API
              2. Fixing the saving of forms and validation messages
              3. Fixing unwarranted model updates
              4. Resetting the form
              5. AngularJS $routeParams
              6. Dynamically generated inputs and forms
                1. Validating exercise duration with ng-form
            8. Revisiting Angular scopes
        4. Lesson 4: Adding Data Persistence to Personal Trainer
          1. AngularJS and server interactions
            1. Setting up the persistence store
              1. Seeding the database
          2. $http service basics
          3. Personal Trainer and server integration
            1. Loading exercise and workout data
              1. Loading exercise and workout lists from a server
                1. Implementing the WorkoutService provider
              2. Mapping server data to application models
              3. Understanding promise chaining
              4. Loading exercise and workout data from the server
              5. Fixing workout and exercise detail pages
              6. Creating and resolving custom promises
                1. The $q "when" function
              7. Fixing workout and exercise detail pages continued…
                1. Route resolutions and promises
            2. Performing CRUD on exercises/workouts
              1. Fixing and creating a new workout
              2. Cross-domain access and AngularJS
              3. Using JSONP to make cross-domain requests
              4. Cross-origin resource sharing
          4. Getting started with $resource
            1. RESTful API services
            2. $resource basics
            3. Understanding $resource actions
            4. $resource action invocation
          5. Using $resource to access exercise data
            1. The hidden cost of hiding asynchronicity
          6. Exercising CRUD with $resource
            1. The $resource service with non-RESTful endpoints
          7. Request/response interceptors
            1. Using an interceptor to pass the API key
          8. AngularJS request/response transformers
          9. Handling routing failure for rejected promises
            1. Handling workouts not found
          10. Fixing the 7 Minute Workout app
        5. Lesson 5: Working with Directives
          1. Directives – an introduction
          2. Anatomy of a directive
            1. Creating a workout-tile directive
            2. Exploring the ng-click directive
          3. Building a remote validation directive to validate the workout name
            1. The remote-validator directive (for v1.3 or less)
              1. The require directive definition
              2. The link function
            2. The remote-validator directive in Angular 1.3
          4. Model update on blur
            1. Using priority to affect the order of execution of the compile and link functions
            2. Life cycle of a directive
              1. The priority and multiple directives on a single element
          5. Implementing a remote validation clues directive
            1. Angular $compile service
            2. Directive controller function
            3. Inter-directive communication – integrating busy-indicator and remote-validator
              1. Fixing remote-validator – pre-Angular 1.3
              2. Fixing remote-validator (Angular 1.3)
            4. Injecting HTML in the directive compile function
            5. Understanding directive templates and transclude
          6. Understanding directive-isolated scopes
            1. Creating the AJAX button directive
          7. AngularJS jQuery integration
            1. Integrating the Carousel jQuery plugin with Workout Runner
            2. Tunneling jQuery events with directives
      8. 3. Your AngularJS Technique Library – AngularJS Web Application Cookbook
        1. Lesson 1: Maximizing AngularJS Directives
          1. Introduction
          2. Building a simple element directive
            1. How to do it…
            2. How it works…
            3. There's more…
          3. Working through the directive spectrum
            1. How to do it…
              1. The element directive
              2. The attribute directive
              3. The class directive
              4. The comment directive
            2. How it works…
            3. There's more…
            4. See also
          4. Manipulating the DOM
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          5. Linking directives
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          6. Interfacing with a directive using isolate scope
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          7. Interaction between nested directives
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          8. Optional nested directive controllers
            1. Getting ready
            2. How to do it…
            3. How it works…
          9. Directive scope inheritance
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          10. Directive templating
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          11. Isolate scope
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          12. Directive transclusion
            1. How to do it…
            2. How it works…
            3. See also
          13. Recursive directives
            1. Getting ready
            2. How to do it…
              1. The $compile service
              2. The angular.element() method
              3. The $templateCache
            3. How it works…
            4. There's more…
            5. See also
        2. Lesson 2: Expanding Your Toolkit with Filters and Service Types
          1. Introduction
          2. Using the uppercase and lowercase filters
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          3. Using the number and currency filters
            1. Getting ready…
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also…
          4. Using the date filter
            1. Getting ready…
            2. How to do it…
            3. How it works…
            4. There's more…
          5. Debugging using the json filter
            1. Getting ready…
            2. How to do it…
            3. How it works…
            4. There's more…
          6. Using data filters outside the template
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
          7. Using built-in search filters
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          8. Chaining filters
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
          9. Creating custom data filters
            1. How to do it…
            2. How it works…
            3. There's more…
          10. Creating custom search filters
            1. Getting ready
            2. How to do it…
          11. Filtering with custom comparators
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          12. Building a search filter from scratch
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          13. Building a custom search filter expression from scratch
            1. How to do it…
            2. How it works…
            3. There's more…
          14. Using service values and constants
            1. How to do it…
              1. Service value
              2. Service constant
            2. How it works…
            3. See also
          15. Using service factories
            1. How to do it…
            2. How it works…
            3. See also
          16. Using services
            1. How to do it…
            2. How it works…
            3. See also
          17. Using service providers
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          18. Using service decorators
            1. How to do it…
            2. How it works…
            3. See also
        3. Lesson 3: AngularJS Animations
          1. Introduction
          2. Creating a simple fade in/out animation
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
              1. Keeping things clean
              2. No more boilerplate animation styling
            5. See also
          3. Replicating jQuery's slideUp() and slideDown() methods
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. See also
          4. Creating enter animations with ngIf
            1. Getting ready
            2. How to do it…
              1. CSS3 transition
              2. CSS3 animation
              3. JavaScript animation
            3. How it works…
            4. There's more…
            5. See also
          5. Creating leave and concurrent animations with ngView
            1. Getting ready
            2. How to do it…
              1. CSS3 transition
              2. CSS3 animation
              3. JavaScript animation
            3. How it works…
            4. See also
          6. Creating move animations with ngRepeat
            1. Getting ready
            2. How to do it…
              1. CSS3 transition
              2. CSS3 animation
              3. JavaScript animation
            3. How it works…
            4. There's more…
            5. See also
          7. Creating addClass animations with ngShow
            1. Getting ready
            2. How to do it…
              1. CSS transitions
              2. CSS animation
              3. JavaScript animation
            3. How it works…
            4. See also
          8. Creating removeClass animations with ngClass
            1. Getting ready
            2. How to do it…
              1. CSS transitions
              2. CSS animation
              3. JavaScript animation
            3. How it works…
            4. See also
          9. Your Coding Challenge
          10. Staggering batched animations
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
        4. Lesson 4: Sculpting and Organizing your Application
          1. Introduction
          2. Manually bootstrapping an application
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
          3. Using safe $apply
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
              1. Anti-pattern awareness
          4. Application file and module organization
            1. Getting ready
            2. How to do it…
              1. One module, one file, and one name
              2. Keep your related files close, keep your unit tests closer
              3. Group by feature, not by component type
              4. Don't fight reusability
              5. An example directory structure
          5. Hiding AngularJS from the user
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
          6. Managing application templates
            1. Getting ready
            2. How to do it…
              1. The string template
              2. Remote server templates
              3. Inline templates using ng-template
              4. Pre-defined templates in the cache
            3. How it works…
            4. There's more…
          7. The "Controller as" syntax
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
        5. Lesson 5: Working with the Scope and Model
          1. Introduction
          2. Configuring and using AngularJS events
            1. How to do it…
              1. Broadcasting an event
              2. Emitting an event
              3. Deregistering an event listener
          3. Managing $scope inheritance
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
              1. Troublemaker built-in directives
                1. ngController
                2. ngInclude
                3. ngView
                4. ngRepeat
                5. ngIf
                6. ngSwitch
          4. Working with AngularJS forms
            1. How to do it…
              1. What the form offers you
              2. Tracking the form state
              3. Validating the form
              4. Built-in and custom validators
            2. How it works…
          5. Working with <select> and ngOptions
            1. Getting ready
            2. How to do it…
              1. Populating with an array
                1. Explicitly defining the option values
                2. Explicitly defining the option model assignment
                3. Implementing option groups
              2. Null options
              3. Populating with an object
                1. Explicitly defining option values
            3. How it works…
            4. There's more…
          6. Building an event bus
            1. Getting ready
            2. How to do it…
              1. Basic implementation
              2. Cleanup
              3. Event bus as a service
              4. Event bus as a decorator
            3. How it works…
            4. There's more…
        6. Lesson 6: Testing in AngularJS
          1. Introduction
          2. Configuring and running your test environment in Yeoman and Grunt
            1. How to do it…
              1. Using the right tools for the job
            2. How it works…
            3. There's more…
            4. See also
          3. Understanding Protractor
            1. How it works…
            2. There's more…
            3. See also
          4. Incorporating E2E tests and Protractor in Grunt
            1. Getting ready
            2. How to do it…
              1. Installation
              2. Selenium's WebDriver manager
              3. Modifying your Gruntfile
              4. Setting your Protractor configuration
              5. Running the test suite
            3. How it works…
            4. See also
          5. Writing basic unit tests
            1. Getting ready
            2. How to do it…
              1. Initializing the unit tests
              2. Creating the unit tests
            3. How it works…
              1. Initializing the controller
              2. Initializing the HTTP backend
              3. Formally running the unit tests
            4. There's more…
          6. Writing basic E2E tests
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          7. Setting up a simple mock backend server
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          8. Writing DAMP tests
            1. How to do it…
            2. There's more…
            3. See also
          9. Using the Page Object test pattern
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
        7. Lesson 7: Screaming Fast AngularJS
          1. Introduction
          2. Recognizing AngularJS landmines
            1. How to do it…
              1. Expensive filters in ng-repeat
              2. Deep watching a large object
              3. Using $watchCollection when the index of change is needed
              4. Keeping template watchers under control
            2. There's more…
            3. See also
          3. Creating a universal watch callback
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          4. Inspecting your application's watchers
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          5. Deploying and managing $watch types efficiently
            1. How to do it…
              1. Watch as little of the model as possible
              2. Keep watch expressions as lightweight as possible
              3. Use the fewest number of watchers possible
              4. Keep the watch callbacks small and light
              5. Create DRY watchers
            2. See also
          6. Optimizing the application using reference $watch
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          7. Optimizing the application using equality $watch
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          8. Optimizing the application using $watchCollection
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          9. Optimizing the application using $watch deregistration
            1. How to do it…
            2. How it works…
            3. See also
          10. Optimizing template-binding watch expressions
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          11. Optimizing the application with the compile phase in ng-repeat
            1. Getting ready
            2. How to do it…
            3. How it works…
            4. There's more…
            5. See also
          12. Optimizing the application using track by in ng-repeat
            1. How to do it…
            2. How it works…
            3. See also
          13. Trimming down watched models
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
        8. Lesson 8: Promises
          1. Introduction
          2. Understanding and implementing a basic promise
            1. How to do it…
            2. How it works…
              1. Basic components and behavior of a promise
                1. Deferreds
                2. Promises
            3. See also
          3. Chaining promises and promise handlers
            1. Getting ready
            2. How to do it…
              1. Data handoff for chained handlers
              2. Rejecting a chained handler
            3. How it works…
            4. There's more…
              1. Promise handler trees
              2. The catch() method
              3. The finally() method
            5. See also
          4. Implementing promise notifications
            1. How to do it…
            2. How it works…
            3. There's more…
          5. Your Coding Challenge
          6. Implementing promise barriers with $q.all()
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          7. Creating promise wrappers with $q.when()
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          8. Using promises with $http
            1. How to do it…
            2. How it works…
            3. See also
          9. Using promises with $resource
            1. How to do it…
            2. How it works…
            3. See also
          10. Using promises with Restangular
            1. How to do it…
            2. How it works…
            3. See also
          11. Incorporating promises into native route resolves
            1. How to do it…
            2. How it works…
            3. There's more…
            4. See also
          12. Implementing nested ui-router resolves
            1. How to do it…
              1. State promise inheritance
              2. Single-state promise dependencies
            2. How it works…
            3. See also
      9. 4. Full-Stack AngularJS – MEAN Web Development
        1. Lesson 1: Getting Started with Node.js
          1. Introduction to Node.js
            1. JavaScript event-driven programming
            2. Node.js event-driven programming
          2. JavaScript closures
          3. Node modules
            1. CommonJS modules
            2. Node.js core modules
            3. Node.js third-party modules
            4. Node.js file modules
            5. Node.js folder modules
          4. Developing Node.js web applications
            1. Meet the Connect module
              1. Connect middleware
              2. Understanding the order of Connect middleware
              3. Mounting Connect middleware
        2. Lesson 2: Building an Express Web Application
          1. Introduction to Express
          2. Installing Express
          3. Creating your first Express application
          4. The application, request, and response objects
            1. The application object
            2. The request object
            3. The response object
          5. External middleware
          6. Implementing the MVC pattern
            1. Application folder structure
              1. Horizontal folder structure
              2. Vertical folder structure
              3. File-naming conventions
              4. Implementing the horizontal folder structure
                1. Handling request routing
                2. Adding the routing file
          7. Configuring an Express application
            1. Environment configuration files
          8. Rendering views
            1. Configuring the view system
            2. Rendering EJS views
          9. Serving static files
          10. Configuring sessions
        3. Lesson 3: Introduction to MongoDB
          1. Introduction to NoSQL
          2. Introducing MongoDB
          3. Key features of MongoDB
            1. The BSON format
            2. MongoDB ad hoc queries
            3. MongoDB indexing
            4. MongoDB replica set
            5. MongoDB sharding
          4. MongoDB shell
          5. MongoDB databases
          6. MongoDB collections
          7. MongoDB CRUD operations
            1. Creating a new document
              1. Creating a document using insert()
              2. Creating a document using update()
              3. Creating a document using save()
            2. Reading documents
              1. Finding all the collection documents
              2. Using an equality statement
              3. Using query operators
              4. Building AND/OR queries
            3. Updating existing documents
              1. Updating documents using update()
              2. Updating documents using save()
            4. Deleting documents
              1. Deleting all documents
                1. Deleting multiple documents
                2. Deleting a single document
        4. Lesson 4: Introduction to Mongoose
          1. Introducing Mongoose
            1. Installing Mongoose
            2. Connecting to MongoDB
          2. Understanding Mongoose schemas
            1. Creating the user schema and model
            2. Registering the User model
            3. Creating new users using save()
            4. Finding multiple user documents using find()
              1. Advanced querying using find()
            5. Reading a single user document using findOne()
            6. Updating an existing user document
            7. Deleting an existing user document
          3. Extending your Mongoose schema
            1. Defining default values
            2. Using schema modifiers
              1. Predefined modifiers
              2. Custom setter modifiers
              3. Custom getter modifiers
            3. Adding virtual attributes
            4. Optimizing queries using indexes
          4. Defining custom model methods
            1. Defining custom static methods
            2. Defining custom instance methods
          5. Model validation
            1. Predefined validators
            2. Custom validators
          6. Using Mongoose middleware
            1. Using pre middleware
            2. Using post middleware
          7. Using Mongoose DBRef
        5. Lesson 5: Managing User Authentication Using Passport
          1. Introducing Passport
            1. Installing Passport
            2. Configuring Passport
          2. Understanding Passport strategies
            1. Using Passport's local strategy
              1. Installing Passport's local strategy module
              2. Configuring Passport's local strategy
            2. Adapting the User model
            3. Creating the authentication views
            4. Modifying the user controller
              1. Displaying flash error messages
                1. Installing the Connect-Flash module
                2. Configuring Connect-Flash module
                3. Using Connect-Flash module
            5. Wiring the user's routes
          3. Understanding Passport OAuth strategies
            1. Setting up OAuth strategies
              1. Handling OAuth user creation
              2. Using Passport's Facebook strategy
                1. Installing Passport's Facebook strategy
                2. Configuring Passport's Facebook strategy
                3. Wiring Passport's Facebook strategy routes
              3. Using Passport's Twitter strategy
                1. Installing Passport's Twitter strategy
                2. Configuring Passport's Twitter strategy
                3. Wiring Passport's Twitter strategy routes
              4. Using Passport's Google strategy
                1. Installing Passport's Google strategy
                2. Configuring Passport's Google strategy
                3. Wiring Passport's Google strategy routes
        6. Lesson 6: Introduction to AngularJS
          1. Introducing AngularJS
          2. Key concepts of AngularJS
            1. The core module of AngularJS
              1. The angular global object
            2. AngularJS modules
              1. Application modules
              2. External modules
              3. Third-party modules
            3. Two-way data binding
            4. Dependency injection
              1. Dependency injection in AngularJS
            5. AngularJS directives
              1. Core directives
              2. Custom directives
            6. Bootstrapping an AngularJS application
              1. Automatic bootstrap
              2. Manual bootstrap
          3. Installing AngularJS
            1. Meeting the Bower dependencies manager
            2. Configuring the Bower dependencies manager
            3. Installing AngularJS using Bower
            4. Configuring AngularJS
          4. Structuring an AngularJS application
          5. Bootstrapping your AngularJS application
          6. AngularJS MVC entities
            1. AngularJS views
            2. AngularJS controllers and scopes
          7. AngularJS routing
            1. Installing the ngRoute module
            2. Configuring the URL scheme
            3. AngularJS application routes
          8. AngularJS services
            1. AngularJS prebundled services
            2. Creating AngularJS services
            3. Using AngularJS services
          9. Managing AngularJS authentication
            1. Rendering the user object
            2. Adding the Authentication service
            3. Using the Authentication service
        7. Lesson 7: Creating a MEAN CRUD Module
          1. Introducing CRUD modules
          2. Setting up the Express components
            1. Creating the Mongoose model
            2. Setting up the Express controller
              1. The error handling method of the Express controller
              2. The create() method of the Express controller
              3. The list() method of the Express controller
              4. The read() middleware of the Express controller
              5. The update() method of the Express controller
              6. The delete() method of the Express controller
              7. Implementing an authentication middleware
              8. Implementing an authorization middleware
            3. Wiring the Express routes
            4. Configuring the Express application
          3. Introducing the ngResource module
            1. Installing the ngResource module
            2. Using the $resource service
          4. Implementing the AngularJS MVC module
            1. Creating the AngularJS module service
            2. Setting up the AngularJS module controller
              1. The create() method of the AngularJS controller
              2. The find() and findOne() methods of the AngularJS controller
              3. The update() method of the AngularJS controller
              4. The delete() method of the AngularJS controller
            3. Implementing the AngularJS module views
              1. The create-article view
              2. The view-article view
              3. The edit-article view
              4. The list-articles view
            4. Wiring the AngularJS module routes
          5. Finalizing your module implementation
        8. Lesson 8: Adding Real-time Functionality Using Socket.io
          1. Introducing WebSockets
          2. Introducing Socket.io
            1. The Socket.io server object
              1. Socket.io handshaking
              2. The Socket.io configuration middleware
            2. The Socket.io client object
            3. Socket.io events
              1. Handling events
              2. Emitting events
            4. Socket.io namespaces
              1. Socket.io server namespaces
              2. Socket.io client namespaces
            5. Socket.io rooms
              1. Joining and leaving rooms
              2. Emitting events to rooms
          3. Installing Socket.io
            1. Configuring the Socket.io server
            2. Configuring the Socket.io session
              1. Installing the connect-mongo and cookie-parser modules
              2. Configuring the connect-mongo module
              3. Configuring the Socket.io session
          4. Building a Socket.io chat
            1. Setting the event handlers of the chat server
            2. Creating the Socket service
            3. Creating the chat controller
            4. Creating the chat view
            5. Adding chat routes
            6. Finalizing the chat implementation
        9. Lesson 9: Testing MEAN Applications
          1. Introducing JavaScript testing
            1. TDD, BDD, and unit testing
            2. Test frameworks
            3. Assertion libraries
            4. Test runners
          2. Testing your Express application
            1. Introducing Mocha
            2. Introducing Should.js
            3. Introducing SuperTest
            4. Installing Mocha
            5. Installing the Should.js and SuperTest modules
            6. Configuring your test environment
            7. Writing your first Mocha test
              1. Testing the Express model
              2. Testing the Express controller
            8. Running your Mocha test
          3. Testing your AngularJS application
            1. Introducing the Jasmine framework
            2. AngularJS unit tests
              1. Introducing Karma test runner
              2. Installing the Karma command-line tool
              3. Installing Karma's dependencies
              4. Configuring the Karma test runner
              5. Mocking AngularJS components
                1. Introducing ngMock
                2. Installing ngMock
              6. Writing AngularJS unit tests
                1. Testing modules
                2. Testing controllers
                3. Testing services
                4. Testing routes
                5. Testing directives
                6. Testing filters
              7. Writing your first unit test
              8. Running your AngularJS unit tests
            3. AngularJS E2E tests
              1. Introducing the Protractor test runner
              2. Installing the Protractor test runner
              3. Configuring the Protractor test runner
              4. Writing your first E2E test
              5. Running your AngularJS E2E tests
        10. Lesson 10: Automating and Debugging MEAN Applications
          1. Introducing the Grunt task runner
            1. Installing the Grunt task runner
            2. Configuring Grunt
              1. Running your application using Grunt
              2. Testing your application using Grunt
              3. Linting your application using Grunt
              4. Watching file changes using Grunt
          2. Debugging Express with node-inspector
            1. Installing node-inspector's grunt task
            2. Configuring node-inspector's grunt task
            3. Running the debug grunt task
          3. Debugging AngularJS with Batarang
            1. Using Batarang
              1. Batarang Models
              2. Batarang Performance
              3. Batarang Dependencies
              4. Batarang options
        11. Reflect and Test Yourself! Answers
          1. Part 1: AngularJS Essentials
          2. Part 2: AngularJS By Example
          3. Part 4: MEAN Web Development
        12. Bibliography
      10. Index