O'Reilly logo

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

Switching to Angular - Third Edition

Book Description

Switching to Angular, Third Edition is the go-to book to align and get started with the Angular JavaScript framework. Angular contributor and international speaker Minko Gechev will help you square up and start building Angular apps and provide you an insight to the Google’s vision for the framework.

About This Book

  • Get up to date with Google’s vision for Angular
  • Align with Angular version 5 and beyond from any direction with confidence
  • Start using TypeScript to supercharge your Angular applications
  • Understand the new framework from AngularJS perspective using your prior experience
  • Use Angular to quickly build fast and scalable enterprise applications

Who This Book Is For

This book is for software developers who want to align with a modern version of Angular that’s aligned with Google’s vision of Angular version 5 and beyond, using stable APIs that they can depend on today and in the future. Also for anyone assessing changes to Angular and squaring up for a strategic migration to Angular v5, and for AngularJS developers who want to transfer their mindset to modern Angular version 5 and beyond.

What You Will Learn

  • Align with Google’s vision for Angular version 5 and beyond
  • Confidently move forwards with a long-term understanding of Angular
  • Use stable APIs in Angular to build future-proof, blazingly fast, enterprise applications
  • Work with TypeScript to supercharge your Angular applications
  • Understand the core concepts of Angular, aligned with the vision from Google
  • Be ready with Angular from any direction - whether you’re building new new apps with the Angular and ASP.NET stack or upgrading from AngularJS with ngUpgrade

In Detail

Align your work to stable APIs of Angular, version 5 and beyond, with Angular expert Minko Gechev. Angular is the modern Google framework for you to build high-performing, SEO-friendly, and robust web applications. Switching to Angular, Third Edition shows you how you can align your current and future development with Google’s long term vision for Angular. Gechev shares his expert knowledge and community involvement to give you the clarity you need to confidently switch into Angular and stable APIs.

Minko Gechev helps you square up to Angular with an overview of the framework, and understand the long term building blocks of Google’s web framework. Gechev then gives you the lowdown on TypeScript, with a crash-course so you can take advantage of Angular in its native, statically-typed environment. You’ll next move on to see how you can line up with Angular dependency injection, plus how Angular router and forms, and Angular pipes, are designed to work for your projects today and in the future.

You'll be squared up and aligned with the vision and techniques of the one Angular, and be ready to start building quick and efficient Angular applications. You’ll know how to take advantage of the latest Angular features, and the core, stable APIs that you can depend on. You’ll be ready to confidently plan your future with the Angular framework.

Style and approach

In this book, Minko Gechev continues his direct style of sharing knowledge about Angular that he's developed across more than 40 international presentations to Angular developers. First, Minko explains Google's vision of Angular to you, and then you dive into a clear tutorial to work with Angular that's aligned with Google's vision of Angular.

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. 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. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Switching to the One Angular
    1. Introducing the One Angular
    2. From AngularJS to Angular
    3. The new beginning
    4. Angular and SemVer
    5. Summary
  3. Get Going with Angular
    1. The evolution of the web – time for a new framework
    2. The evolution of ECMAScript
      1. Web components
      2. Web workers
    3. Lessons learned from AngularJS in the wild
      1. Controllers
      2. Scope
      3. Dependency injection
      4. Server-side rendering
      5. Applications that scale
      6. Templates
      7. Change detection
    4. Summary
  4. The Building Blocks of an Angular Application
    1. A conceptual overview of Angular
    2. Changing directives
    3. Getting to know Angular components
      1. Components in action
      2. Components in Angular
    4. Angular modules
      1. Bootstrapping an Angular application
    5. Pipes
      1. Defining pipes
    6. Improving change detection
      1. Classical change detection
      2. Change detection in AngularJS
        1. In zone.js
        2. Simplified data flow
      3. Enhancing AngularJS's change detection
    7. Services
    8. The new router
      1. Angular route definition syntax
    9. Summary
  5. TypeScript Crash Course
    1. Introduction to TypeScript
      1. Compile-time type checking
      2. Better support by text editors and IDEs
      3. There's even more to TypeScript
    2. Using TypeScript
      1. Installing TypeScript with npm
      2. Running our first TypeScript program
    3. TypeScript syntaxes and features introduced by ES2015 and ES2016
      1. ES2015 arrow functions
      2. Using the ES2015 and ES2016 classes
      3. Defining variables with block scope
    4. Meta-programming with ES2016 decorators
      1. Using configurable decorators
    5. Writing modular code with ES2015
      1. Using the ES2015 module syntax
      2. Taking advantage of the implicit asynchronous behavior of the module
      3. Using aliases
      4. Importing all the module exports
      5. Default exports
    6. ES2015 module loader
    7. ES2015 and ES2016 recap
    8. Taking advantage of static typing
      1. Using explicit type declarations
        1. The any type
      2. Understanding the primitive types
        1. The Enum types
      3. Understanding the object types
        1. The array types
        2. The Function types
      4. Defining classes
      5. Using access modifiers
      6. Defining interfaces
        1. Interface inheritance
        2. Implementing multiple interfaces
    9. Further expressiveness with TypeScript decorators
    10. Writing generic code using type parameters
      1. Using generic functions
      2. Having multiple type parameters
    11. Writing less verbose code with the type inference of TypeScript
      1. Best common type
      2. Contextual type inference
    12. Introducing structural typing
    13. Using ambient type definitions
      1. Using predefined ambient type definitions
      2. Custom ambient type definitions
    14. Summary
  6. Getting Started with Angular Components and Directives
    1. The "Hello world!" application in Angular
      1. Setting up our environment
      2. Installing the sample project repository
    2. Using Angular and TypeScript
    3. Using Angular directives
      1. The ngFor directive
    4. Improved semantics of the directives syntax
      1. Declaring variables inside a template
      2. Using syntax sugar in templates
    5. Defining Angular directives
      1. Setting the directive's inputs
      2. Understanding the directive's constructor
      3. Better encapsulation of directives with NgModules
    6. Using NgModules for declaring reusable components
      1. Using the custom element schema
    7. Creating custom Angular components
      1. Introducing the component's view encapsulation
      2. Implementing the component's controllers
      3. Handling user actions
      4. Using inputs and outputs
      5. Determining the inputs and outputs
      6. Defining the inputs and outputs
      7. Passing inputs and consuming the outputs
      8. Event bubbling
      9. Renaming the inputs and outputs
      10. An alternative syntax to define inputs and outputs
    8. Explaining Angular's content projection
      1. Basic content projection in Angular
      2. Projecting multiple content chunks
      3. Nesting components
      4. Using view children and content children
      5. View child versus content child
    9. Hooking into the component's life cycle
      1. Order of execution of the life cycle hooks
    10. Defining generic views with TemplateRef
    11. Understanding and enhancing the change detection
      1. The order of execution of the change detectors
      2. Understanding Angular's change detection strategies
      3. Introducing immutable data structures and OnPush
      4. Using immutable data in Angular
    12. Summary
  7. Dependency Injection in Angular
    1. Why do I need dependency injection?
    2. Dependency injection in Angular
      1. Benefits of using dependency injection
    3. Declaring providers
      1. Using the @Injectable decorator
      2. Introducing forward references
      3. Configuring providers
        1. Using existing providers
    4. Defining factories for instantiating services
    5. Declaring optional dependencies
    6. Understanding multiproviders
    7. Child injectors and visibility
      1. Instantiating an injector
      2. Building a hierarchy of injectors
    8. Using dependency injection with components and directives
      1. Introducing the element injectors
      2. Declaring providers for the element injectors
        1. Exploring dependency injection with components
      3. View providers versus providers
      4. Using the @SkipSelf decorator
    9. Summary
  8. Working with the Angular Router and Forms
    1. Developing the "Coders repository" application
    2. Exploring the Angular router
      1. Using PathLocationStrategy
      2. Configuring routes
      3. Using routerLink and router-outlet
      4. Lazy-loading with loadChildren
        1. Prefetching of the lazy-loaded routes
        2. RouterModule.forRoot versus RouterModule.forChild
    3. Using Angular's forms module
      1. Developing template-driven forms
      2. Digging into the markup of the template-driven form
      3. Using the built-in validators
      4. Defining custom validators
      5. Using select inputs with Angular
      6. Using the NgForm directive
    4. Two-way data binding with Angular
    5. Storing the form data
    6. Listing all the stored data
    7. Summary
  9. Explaining Pipes and Communicating with RESTful Services
    1. Developing model-driven forms in Angular
      1. Using composition of control validators
    2. Exploring the HTTP module of Angular
      1. Using Angular's HTTP module
    3. Defining parameterized views
    4. Defining nested routes
    5. Transforming data with pipes
      1. Developing stateless pipes
      2. Using Angular's built-in pipes
      3. Developing stateful pipes
      4. Using stateful pipes
      5. Using Angular's AsyncPipe
        1. Using AsyncPipe with observables
    6. Summary
  10. Tooling and Development Experience
    1. Running an application in a web worker
      1. Web workers and Angular
      2. Bootstrapping an application running in a web worker
      3. Migrating an application to web workers
      4. Making an application compatible with web workers
    2. Initial load of a single-page application
      1. Initial load of a single-page application with server-side rendering
      2. Server-side rendering with Angular
    3. Enhancing our development experience
      1. Text editors and IDEs
      2. Angular language service
      3. Bootstrapping a project with angular-cli
      4. Using angular-cli
    4. Angular quick starters
      1. Angular seed
      2. Angular webpack starter
    5. Ahead-of-time compilation in Angular
      1. How code generation works
      2. Introducing the concept of ahead-of-time compilation
      3. Constraints of the ahead-of-time compilation
      4. How to use the ahead-of-time compilation of Angular
    6. Summary