• Stars
    star
    1,527
  • Rank 30,045 (Top 0.7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Angular and TypeScript JumpStart example application

Angular JumpStart with TypeScript

The goal of this jumpstart app is to provide a simple way to get started with Angular 2+ while also showing several key Angular features. The sample relies on the Angular CLI to build the application.

Looking for expert onsite Angular/TypeScript training? We've trained the biggest (and smallest :-)) companies around the world for over 15 years. For more information visit https://codewithdan.com.

Angular Concepts Covered

  • TypeScript version that relies on classes and modules
  • Modules are loaded with System.js
  • Defining routes including child routes and lazy loaded routes
  • Using Custom Components including custom input and output properties
  • Using Custom Directives
  • Using Custom Pipes
  • Defining Properties and Using Events in Components/Directives
  • Using the Http object for Ajax calls along with RxJS observables
  • Working with Utility and Service classes (such as for sorting and Ajax calls)
  • Using Angular databinding Syntax [], () and [()]
  • Using template-driven and reactive forms functionality for capturing and validating data
  • Optional: Webpack functionality is available for module loading and more (see below for details)
  • Optional: Ahead-of-Time (AOT) functionality is available for a production build of the project (see below for details)

Standalone Components Example

An example of this application that uses standalone components (no modules) can be found in the standalone-components branch.

Running the Application with Node.js

  1. Install the latest LTS version of Node.js from https://nodejs.org. IMPORTANT: The server uses ES2015 features AND the Angular CLI so you need a current version of Node.js.

  2. Run npm install to install app dependencies

  3. Run ng build angular-jumpstart --watch to build and bundle the code

  4. Run npm start in a separate terminal window to launch the web and RESTful API server

  5. Go to http://localhost:8080 in your browser

NOTE: You'll need to supply your own Google Maps API key in the shared/map.component.ts file to see the full map functionality. Update https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY with your key.

Simply clone the project or download and extract the .zip to get started.

Once the app is running you can play around with editing customers after you login. Use any email address and any password that's at least 6 characters long (with 1 digit).

Here are a few screenshots from the app:







Running the Application with Deno

  1. Install the latest version of Deno from https://deno.land

  2. If using VS Code (Optional):

  1. Run npm install to install the Angular dependencies

  2. Run ng build to build and bundle the code

  3. cd into ./deno and run the following command:

    deno run --allow-net --allow-read --unstable server.ts

  4. Go to http://localhost:8080 in your browser

Running Angular Playground

This application includes Angular Playground (http://www.angularplayground.it) which provides a great way to isolate components in a sandbox rather than loading the entire application to see a given component. To run the playground run the following command:

npm run playground

Then open a browser and visit http://localhost:4201 and follow the directions there (or visit their website for more information).

Running in Kubernetes

  1. Install Docker Desktop from https://www.docker.com/get-started
  2. Start Docker and enable Kubernetes in the Docker Desktop preferences/settings
  3. Run docker-compose build to create the images
  4. Run kubectl apply -f .k8s to start Kubernetes
  5. Visit http://localhost
  6. Stop Kubernetes using kubectl delete -f .k8s

Running with Skaffold

If you'd like to use the Skaffold tool to run the project in Kubernetes, install it, and run the following command:

skaffold dev

To generate the skaffold.yaml file that's included in the project the following command was run and the image context paths it defines were modified:

skaffold init -k '.k8s/*.yml' \
  -a '{"builder":"Docker","payload":{"path":".docker/nginx.dev.dockerfile"},"image":"nginx-angular-jumpstart"}' \
  -a '{"builder":"Docker","payload":{"path":".docker/node.dockerfile"},"image":"node-service-jumpstart"}'

If you wanted to generate the initial Kubernetes manifest files from an existing docker-compose.yml file you can use the following command. It uses the Kompose tool behind the scenes to create the YAML files

skaffold init --compose-file docker-compose.yml \
  -a '{"builder":"Docker","payload":{"path":".docker/nginx.dev.dockerfile"},"image":"nginx-angular-jumpstart"}' \
  -a '{"builder":"Docker","payload":{"path":".docker/node.dockerfile"},"image":"node-service-jumpstart"}'

Running in the Azure Static Web Apps Service

Check out my post on Getting Started with Azure Static Web Apps.

Kubernetes Day Zero Webinar: Deploying to Kubernetes

Dan Wahlin

Twitter: @DanWahlin

https://codewithdan.com

Resources mentioned:

Agenda

  1. Container Orchestration Options (Docker Swarm, Kubernetes)

  2. Using Docker Compose

    docker-compose build
    docker-compose up
    docker-compose down
    
  3. Docker Stacks --> Docker Desktop --> Kubernetes

    docker stack deploy -c docker-compose.yml angular-jumpstart
    docker stack ls
    docker stack rm angular-jumpstart
    
  4. Deploying Containers to Kubernetes

    https://kompose.io/

    kompose convert -h
    kompose convert -f docker-compose.yml -o ./[your-folder-goes-here]
    

    Tweak the generated YAML. Then once ready run:

    kubectl apply -f [your-folder-name]
    

My Kubernetes for Developers video courses on Pluralsight.com:

https://pluralsight.pxf.io/danwahlin

Azure Container Apps

Build API Image

  1. Go to https://github.com/danwahlin/angular-jumpstart and fork the repo.

  2. Clone the forked repo to your machine.

  3. Run docker-compose build node.

  4. Tag the image with your Docker Hub repo name: docker tag node-service-jumpstart <YOUR_DOCKER_HUB_NAME>/node-service-jumpstart

  5. docker push <YOUR_DOCKER_HUB_NAME>/node-service-jumpstart

Create environment

az containerapp env create -n angular-jumpstart-env -g Angular-Jumpstart-RG \
--location westus3

Deploy the API Container App

az containerapp create -n angular-jumpstart-api -g Angular-Jumpstart-RG \
--environment angular-jumpstart-env \
--image <YOUR_DOCKER_HUB_NAME>/node-service-jumpstart \
--ingress external --target-port 8080

Note the fully qualified domain (fqdn) value assigned to the angular-jumpstart-api container app. You'll need this value in the next section.

Add an .env File

  1. Create a .env file in the project root.

  2. Add the following key/value to the .env file:

NG_APP_API_URL=<FQDN_VALUE_FROM_YOUR_angular-jumpstart-api_CONTAINER_APP>

Build the UI Image

  1. Run docker-compose build nginx.

  2. Tag the image with your Docker Hub repo name:

    docker tag nginx-angular-jumpstart <YOUR_DOCKER_HUB_NAME>/nginx-angular-jumpstart
  3. Push the image to Docker Hub:

    docker push <YOUR_DOCKER_HUB_NAME>/nginx-angular-jumpstart

Deploy UI Container App

Change the image name below to match your image tag from the previous step.

az containerapp create -n angular-jumpstart-ui -g Angular-Jumpstart-RG \
--environment angular-jumpstart-env \
--image <YOUR_DOCKER_HUB_NAME>/nginx-angular-jumpstart \
--ingress external --target-port 80

View the UI App

Navigate to the FQDN value shown after running the previous command.

Add GitHub Continuous Deployment

  1. Create a service principal:

    az ad sp create-for-rbac \
      --name AngularJumpStartServicePrincipal \
      --role "contributor" \
      --scopes /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/Angular-Jumpstart-RG \
      --sdk-auth
  2. Add a GitHub action for the UI container app:

    az containerapp github-action add \
      --repo-url "https://github.com/<OWNER>/<REPOSITORY_NAME>" \
      --context-path "./.docker/nginx.dockerfile" \
      --branch main \
      --name angular-jumpstart-ui \
      --image <YOUR_DOCKER_HUB_NAME>/nginx-angular-jumpstart
      --resource-group Angular-Jumpstart-RG \
      --registry-url docker.io \
      --registry-username <REGISTRY_USER_NAME> \
      --registry-password <REGISTRY_PASSWORD> \
      --service-principal-client-id <CLIENT_ID> \
      --service-principal-client-secret <CLIENT_SECRET> \
      --service-principal-tenant-id <TENANT_ID> \
      --login-with-github
  3. Add a GitHub action for the API container app:

    az containerapp github-action add \
      --repo-url "https://github.com/<OWNER>/<REPOSITORY_NAME>" \
      --context-path "./.docker/node.dockerfile" \
      --branch main \
      --name angular-jumpstart-api \
      --image <YOUR_DOCKER_HUB_NAME>/node-service-jumpstart
      --resource-group Angular-Jumpstart-RG \
      --registry-url docker.io \
      --registry-username <REGISTRY_USER_NAME> \
      --registry-password <REGISTRY_PASSWORD> \
      --service-principal-client-id <CLIENT_ID> \
      --service-principal-client-secret <CLIENT_SECRET> \
      --service-principal-tenant-id <TENANT_ID> \
      --login-with-github
  4. IMPORTANT: Once the GitHub actions are added, pull the latest changes to your local repository.

  5. Open each action file in .github/workflows and change the properties under on: to the following (in both files):

    # When this action will be executed
    on:
      push:
        branches:
        - main
      pull_request:
        types: [opened, synchronize, reopened, closed]
        branches:
        - main
  6. Make the following changes to each respective workflow file:

    angular-jumpstart-ui workflow

    build-args: NG_APP_API_URL=${{ secrets.NG_APP_API_URL }}
    file: ./.docker/nginx.dockerfile
    context: ./

    angular-jumpstart-api workflow

    file: ./.docker/node.dockerfile
    context: ./
  7. Go to your GitHub.com and navigate to your forked repo. Select Settings --> Secrets --> Actions from the toolbar.

  8. Add the following key/value into the repository secrets. This is needed for the CI build that generates the UI image.

    NG_APP_API_URL=<FQDN_VALUE_FROM_YOUR_angular-jumpstart-api_CONTAINER_APP>
    
  9. Push your changes up to your repo.

  10. Go to your GitHub repo on Github.com and select Actions from the toolbar. You should see the actions building (and hopefully deploy successfully).

  11. Go to the FQDN of your angular-jumpstart-ui container app in the browser. The app should load if your GitHub actions deployed successfully.

More Repositories

1

angular-architecture

Examples of Angular Architecture Concepts
TypeScript
786
star
2

CustomerManager

CustomerManager AngularJS/BreezeJS Application with a custom route provider.
JavaScript
709
star
3

CustomerManagerStandard

Customer Manager AngularJS/BreezeJS Application.
JavaScript
648
star
4

Observable-Store

Observable Store provides a simple way to manage state in Angular, React, Vue.js and other front-end applications.
TypeScript
619
star
5

DockerAndKubernetesCourseCode

Course code for the Docker and Kubernetes course: https://codewithdan.com/products/docker-kubernetes
C#
350
star
6

Angular-RESTfulService

Example of Angular calling into a RESTful service
JavaScript
268
star
7

TypeScriptDemos

A set of TypeScript demos showing various features of the language.
HTML
233
star
8

Angular-Docker-Microservices

Example of serving an Angular app to the browser using nginx. App calls Node.js/MongoDB and ASP.NET Core/PostgreSQL microservices.
C#
213
star
9

AngularIn20TypeScript

Simple AngularJS Applications with TypeScript
JavaScript
203
star
10

CodeWithDanDockerServices

Demonstration of using Docker and/or Kubernetes to orchestrate multiple services
JavaScript
197
star
11

AspNetCorePostgreSQLDockerApp

ASP.NET Core with PostgreSQL Docker App Demo
C#
193
star
12

ES2015Samples

A set of ECMAScript 2015 examples as well as a Gulp file that converts them to ES5 using Babel.
JavaScript
180
star
13

Angular-NodeJS-MongoDB-CustomersService

Code for the Integrating Angular with Node.js RESTful Services Pluralsight course.
TypeScript
162
star
14

Angular-Core-Concepts

Provides a simple demo application covering Angular core concepts (components, services, modules, routing)
TypeScript
160
star
15

NodeExpressMongoDBDockerApp

Node.js with MongoDB Docker App Demo
CSS
152
star
16

Angular-BareBones

Angular and TypeScript Bare Bones Project
TypeScript
149
star
17

AngularOverlay

AngularJS directive used to automatically intercept XHR requests and show an overlay and message in a web page.
JavaScript
147
star
18

Angular-Forms

Angular/TypeScript template-driven and reactive forms example.
TypeScript
122
star
19

AngularCLI-ASPNET-Core-CustomersService

Example of integrating Angular with ASP.NET Core RESTful Services
C#
93
star
20

Docker-for-Web-Developers

Code from the Docker for Web Developers Course on Pluralsight - https://www.pluralsight.com/courses/docker-web-development
HTML
84
star
21

Angular-ASPNET-Core-Seed

An Angular and ASP.NET Core Seed Project to simplify getting started with the two technologies.
TypeScript
77
star
22

AngularTypeScript

An Angular and TypeScript demo app that integrates with Azure AD and Office 365 cloud services.
TypeScript
72
star
23

Angular-ASPNET-Core-CustomersService

Angular and ASP.NET Core RESTful Services
C#
62
star
24

Angular-WebSockets

Example of using Angular services and RxJS observables with a WebSockets Server
TypeScript
60
star
25

typescript-fundamentals

Sample code from the TypeScript Fundamentals course on Pluralsight.com
TypeScript
55
star
26

ES6-Modules-Starter

Simple ES6 Modules starter project that uses Gulp, Babel and SystemJS
JavaScript
46
star
27

MasteringJavaScriptCourseCode

Code for the Mastering JavaScript course.
JavaScript
45
star
28

AngularCLI-NodeJS-MongoDB-CustomersService

Code for the Integrating Angular with Node.js RESTful Services Pluralsight course.
JavaScript
36
star
29

FluidAngular

Angular/Fluid demos
TypeScript
32
star
30

AngularWorkshopLabs

Angular and TypeScript Workshop Labs
TypeScript
31
star
31

ASP.NETCoreDemos

ASP.NET Core Demos
C#
29
star
32

Angular-Snippets

This VS Code extension adds Angular/TypeScript/HTML code snippets into your editor.
26
star
33

ASPNETCore-Sync-Async-EF

Demo app showing sync versus async calls with ASP.NET Core and Entity Framework Core. Also includes a simple Angular app that consumes the data.
C#
23
star
34

AccountAtAGlance

ASP.NET MVC, Entity Framework, Web API, jQuery, HTML5 application that demonstrates how multiple technologies can be used together.
JavaScript
23
star
35

AccountAtAGlance-ASPCore

ASP.NET Core MVC and Entity Framework Core Dashboard Application
JavaScript
22
star
36

Microservices-ASPNET-Core-Docker-Course

Code for Microservices, ASP.NET Core and Docker Training Course from https://codewithdan.com
C#
18
star
37

AngularAppDevCourseCode

Code used in the Angular Application Development course.
TypeScript
17
star
38

NodeJSEndToEndCourseCode

Lab code and samples for the Node.js End-to-End Development Course.
JavaScript
16
star
39

openai-acs-msgraph

Example of using Microsoft Graph Toolkit with Angular
TypeScript
16
star
40

So-You-Want-To-Be-A-Web-Developer

Code from the "So You Want To Be A Web Developer" workshop series.
HTML
13
star
41

AngularJSEndToEndCourseCode

Lab code and samples for the AngularJS End-to-End Development Course.
JavaScript
11
star
42

express-convention-routes

Convention-based routes for Express
JavaScript
10
star
43

AngularCustomDirectives

A few simple custom Angular directives for learning purposes.
JavaScript
10
star
44

CoreWebAPIAndAngular

Demonstration of using ASP.NET Core Web API features with Angular 2
C#
10
star
45

Getting-Started-With-TypeScript

JavaScript
8
star
46

M365EndToEnd

Microsoft 365 end-to-end application demo (SSO, Teams, bot, etc.)
JavaScript
8
star
47

ASP.NETCoreCourseCode

ASP.NET Core Course Code
HTML
7
star
48

React-Core-Concepts

Provides a simple demo application covering React core concepts.
JavaScript
7
star
49

angular-swapi

Simple example of using Angular to call into the Star Wars API (https://swapi.co)
TypeScript
7
star
50

NodeJSWorkshop

Node.js Samples
JavaScript
6
star
51

Angular-DynamicComponentDashboard

Example of using Angular to build a dynamic dashboard
TypeScript
6
star
52

AngularIn20JavaScript

Simple AngularJS Application with JavaScript
JavaScript
6
star
53

react-hooks-demos

Simple demos of using React hooks.
TypeScript
5
star
54

AdvancedCSCourseCode

Code for the Advanced C# Course
C#
5
star
55

FluidBrainstorm

TypeScript
5
star
56

AzureForDevelopersCourse

Code for the Azure for Web Developers instructor-led course - https://codewithdan.com/products/azure-for-developers
5
star
57

Timesheets

Old prototype app to convert
JavaScript
5
star
58

FluidVue

TypeScript
5
star
59

Angular-In120

Sample application and code used for the Angular 120-Minute JumpStart video course.
TypeScript
4
star
60

angular-todo-list-fluid

TypeScript
4
star
61

FluidFAST

Fluid demos using FAST web components
TypeScript
3
star
62

github-repo-stats

JavaScript
3
star
63

TailwindTraders-M365

LOB demo app for Teams/M365
TypeScript
3
star
64

HTML5CourseCode

HTML5/CSS3 Course Code
HTML
3
star
65

CopilotChallenge

Copilot challenges
JavaScript
2
star
66

React-Todos-With-Hooks

JavaScript
2
star
67

microsoft-cloud-services-builder

Visual builder tool to help find services and documentation across the Microsoft Cloud.
TypeScript
2
star
68

github-slideshow

A robot powered training repository 🤖
Ruby
2
star
69

jQuery-Tips-And-Tricks

HTML
2
star
70

acs-voice-calling-quickstart

Example of getting started with Azure Communication Services voice calling.
JavaScript
2
star
71

Featured-Content

Application framework that can be used to feature and filter content.
TypeScript
2
star
72

jQueryCourseCode

Code for the Mastering jQuery course created by Wahlin Consulting.
HTML
1
star
73

GDClassCodeSept2016

C# and ASP.NET MVC Course Code Samples/Labs
JavaScript
1
star
74

Angular-HelloWorld

HTML
1
star
75

Teams-Webhooks-Connectors

Code from the Learn module located at https://docs.microsoft.com/en-us/learn/modules/msteams-webhooks-connectors/
TypeScript
1
star
76

React-Recoil-And-Hooks

Demonstration of using React Hooks with Recoil.
TypeScript
1
star