1a - Brief Introduction To Angular

In the next few sections we will review the main part of Angular. In this first part we will review creating a CLI app and using event and property binding with templates.

The finished code for the next three parts can be found here https://github.com/duncanhunter/workshop-enterprise-angular-applications-with-ngrx-and-nx-cli-only

git clone "https://github.com/duncanhunter/workshop-enterprise-angular-applications-with-ngrx-and-nx-cli-only"
cd workshop-enterprise-angular-applications-with-ngrx-and-nx-cli-only
npm install

1. Create a new Angular CLI Project

  • Make a new workshop folder and generate a new CLI app

mkdir workshop
cd workshop
ng new angular-cli-app --routing

Change directory into the new app's directory and open it with VS Code

cd angular-cli-app
code .

2. Run the app

  • Run the below command 's' is short for serve.

ng s

Look at output.

Bundled javascript files added to index.html dynamically

3. Review the structure and key files

  • package.json

  • index.html

  • main.ts

  • app.module.ts

  • app.component.ts

  • app-routing.module.ts

4. Add a Home page component

  • Add home page component

  • Add home component selector to the AppComponent and delete all default HTML except the router outlet.

5. Add a route

6. Event and data binding

  • Add event and data binding to Home component with a new title property

  • Add a function to the Home component.

Last updated