Introduction to Angular

What is Angular?

Angular is:

  • Maintained by Google and the community

  • Client side framework for creating powerful web applications

  • Evolved from AngularJS and is continually being improved

  • Open Source (MIT License)

Documentation

Angular is rarely just "installed", tools like the CLI help us create and configure our applications

https://angular.io/

https://github.com/angular/angular

QuickStart

The quick-start guide is a great place to start learning how to build your first application

https://angular.io/guide/quickstart

Angular Features

  • Made for creating modern web applications

  • Separation of concerns - MVC

  • Dependency Injection

  • Testing using Karma and Jasmine

  • E2E testing with Protractor

  • Angular CLI standardizes project setup, build, and deploy

  • Supports performance and SEO optimizations using lazing loading and Angular Universal

  • Community tooling

Why Angular?

  • Manage complexity

    • Backend API calls

    • Validating user input

    • Application Navigation

    • User/System events

  • Superior tooling

  • TypeScript

  • Enterprise ready

Architecture Overview

  • Components

  • Services

  • Directives

  • Pipes

  • Modules

Angular vs AngularJS

  • Fixed fundamental architecture issues

  • Replaces controllers with components

  • Modules to help organize code

  • TypeScript

  • Angular-CLI

My First Angular Application

Install the Angular CLI

Create my first Angular application

Pro Tip: create a folder in your home/root directory called repo and put all your projects there.

What was created?

Use an editor like VS Code to make changes to your code. Using ctrl-shift-P you can configure VS code to open from the command line. If properly configured you can open VS Code using:

code .

Angular CLI generated my project

Running my application

How does it work?

index.html

app.component.ts

app.module.ts

main.ts

Angular Wire-up

  • Application must be contained in a single module (can have multiple sub-modules)

  • Angular-CLI generates

    • app.module.ts

      • imports

        • components

        • services

        • modules

    • main.ts

      • Bootstraps the app.module

    • index.html

      • Renders app.component.ts using app-root selector

Modify our application

Create username form

Adding the Forms Module

Angular Build Process

Build Artifacts

The Angular-CLI builds the application, creates a dist folder, and places artifacts into the folder.

Angular adds the build artifacts automatically

Summary

  • We learned

    • Basic features of Angular

    • How to create an Angular application

    • How Angular wires up my application

    • Files created by Angular-CLI

Last updated