• This repository has been archived on 10/Jan/2023
  • Stars
    star
    3,128
  • Rank 14,371 (Top 0.3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 3 years ago

Reviews

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

Repository Details

Angular QuickStart - source from the documentation

Angular QuickStart Source

Build Status

This repository is now deprecated. The Angular Quickstart project was a nice starting point for creating Angular applications. Now we recommend using the Angular CLI to create new Angular projects.

Starting from 1 November 2017, all the Angular documentation, at angular.io, is based on the Angular CLI.

Let's get started


This repository holds the TypeScript source code of the angular.io quickstart, the foundation for most of the documentation samples and potentially a good starting point for your application.

It's been extended with testing support so you can start writing tests immediately.

This is not the perfect arrangement for your application. It is not designed for production. It exists primarily to get you started quickly with learning and prototyping in Angular

We are unlikely to accept suggestions about how to grow this QuickStart into something it is not. Please keep that in mind before posting issues and PRs.

Updating to a newer version of the Quickstart Repo

From time to time the QuickStart will be enhanced with support for new features or to reflect changes to the official Style Guide.

You can update your existing project to an up-to-date QuickStart by following these instructions:

  • Create a new project using the instructions below
  • Copy the code you have in your project's main.ts file onto src/app/main.ts in the new project
  • Copy your old app folder into src/app
  • Delete src/app/main.ts if you have one (we now use src/main.ts instead)
  • Copy your old index.html, styles.css and tsconfig.json into src/
  • Install all your third party dependencies
  • Copy your old e2e/ folder into e2e/
  • Copy over any other files you added to your project
  • Copy your old .git folder into your new project's root

Now you can continue working on the new project.

Prerequisites

Node.js and npm are essential to Angular development.

Get it now if it's not already installed on your machine.

Verify that you are running at least node v4.x.x and npm 3.x.x by running node -v and npm -v in a terminal/console window. Older versions produce errors.

We recommend nvm for managing multiple versions of node and npm.

Create a new project based on the QuickStart

Clone this repo into new project folder (e.g., my-proj).

git clone https://github.com/angular/quickstart  my-proj
cd my-proj

We have no intention of updating the source on angular/quickstart. Discard the .git folder..

rm -rf .git  # OS/X (bash)
rd .git /S/Q # windows

Delete non-essential files (optional)

You can quickly delete the non-essential files that concern testing and QuickStart repository maintenance (including all git-related artifacts such as the .git folder and .gitignore!) by entering the following commands while in the project folder:

OS/X (bash)
xargs rm -rf < non-essential-files.osx.txt
rm src/app/*.spec*.ts
rm non-essential-files.osx.txt
Windows
for /f %i in (non-essential-files.txt) do del %i /F /S /Q
rd .git /s /q
rd e2e /s /q

Create a new git repo

You could start writing code now and throw it all away when you're done. If you'd rather preserve your work under source control, consider taking the following steps.

Initialize this project as a local git repo and make the first commit:

git init
git add .
git commit -m "Initial commit"

Recover the deleted .gitignore from the QuickStart repository if you lost it in the Delete non-essential files step.

Create a remote repository for this project on the service of your choice.

Grab its address (e.g. https://github.com/<my-org>/my-proj.git) and push the local repo to the remote.

git remote add origin <repo-address>
git push -u origin master

Install npm packages

See npm and nvm version notes above

Install the npm packages described in the package.json and verify that it works:

npm install
npm start

Doesn't work in Bash for Windows which does not support servers as of January, 2017.

The npm start command first compiles the application, then simultaneously re-compiles and runs the lite-server. Both the compiler and the server watch for file changes.

Shut it down manually with Ctrl-C.

You're ready to write your application.

npm scripts

We've captured many of the most useful commands in npm scripts defined in the package.json:

  • npm start - runs the compiler and a server at the same time, both in "watch mode".
  • npm run build - runs the TypeScript compiler once.
  • npm run build:w - runs the TypeScript compiler in watch mode; the process keeps running, awaiting changes to TypeScript files and re-compiling when it sees them.
  • npm run serve - runs the lite-server, a light-weight, static file server, written and maintained by John Papa and Christopher Martin with excellent support for Angular apps that use routing.

Here are the test related scripts:

  • npm test - compiles, runs and watches the karma unit tests
  • npm run e2e - compiles and run protractor e2e tests, written in Typescript (*e2e-spec.ts)

Testing

The QuickStart documentation doesn't discuss testing. This repo adds both karma/jasmine unit test and protractor end-to-end testing support.

These tools are configured for specific conventions described below.

It is unwise and rarely possible to run the application, the unit tests, and the e2e tests at the same time. We recommend that you shut down one before starting another.

Unit Tests

TypeScript unit-tests are usually in the src/app folder. Their filenames must end in .spec.ts.

Look for the example src/app/app.component.spec.ts. Add more .spec.ts files as you wish; we configured karma to find them.

Run it with npm test

That command first compiles the application, then simultaneously re-compiles and runs the karma test-runner. Both the compiler and the karma watch for (different) file changes.

Shut it down manually with Ctrl-C.

Test-runner output appears in the terminal window. We can update our app and our tests in real-time, keeping a weather eye on the console for broken tests. Karma is occasionally confused and it is often necessary to shut down its browser or even shut the command down (Ctrl-C) and restart it. No worries; it's pretty quick.

End-to-end (E2E) Tests

E2E tests are in the e2e directory, side by side with the src folder. Their filenames must end in .e2e-spec.ts.

Look for the example e2e/app.e2e-spec.ts. Add more .e2e-spec.js files as you wish (although one usually suffices for small projects); we configured Protractor to find them.

Thereafter, run them with npm run e2e.

That command first compiles, then simultaneously starts the lite-server at localhost:8080 and launches Protractor.

The pass/fail test results appear at the bottom of the terminal window. A custom reporter (see protractor.config.js) generates a ./_test-output/protractor-results.txt file which is easier to read; this file is excluded from source control.

Shut it down manually with Ctrl-C.

More Repositories

1

angular

Deliver web apps with confidence 🚀
TypeScript
96,000
star
2

angular.js

AngularJS - HTML enhanced for web apps!
JavaScript
59,091
star
3

angular-cli

CLI tool for Angular
TypeScript
26,756
star
4

components

Component infrastructure and Material Design components for Angular
TypeScript
24,333
star
5

material

Material design for AngularJS
JavaScript
16,637
star
6

angular-seed

Seed project for angular apps.
JavaScript
13,027
star
7

protractor

E2E test framework for Angular apps
JavaScript
8,780
star
8

angularfire

Angular + Firebase = ❤️
TypeScript
7,692
star
9

flex-layout

Provides HTML UI layout for Angular applications; using Flexbox and a Responsive API
TypeScript
5,904
star
10

universal

Server-side rendering and Prerendering for Angular
TypeScript
4,040
star
11

zone.js

Implements Zones for JavaScript
TypeScript
3,243
star
12

angular-phonecat

Tutorial on building an angular application.
JavaScript
3,128
star
13

batarang

AngularJS WebInspector Extension for Chrome
JavaScript
2,444
star
14

material-start

Starter Repository for AngularJS Material
JavaScript
2,214
star
15

universal-starter

Angular Universal starter kit by @AngularClass
TypeScript
2,028
star
16

mobile-toolkit

Tools for building progressive web apps with Angular
JavaScript
1,344
star
17

in-memory-web-api

The code for this project has moved to the angular/angular repo. This repo is now archived.
TypeScript
1,172
star
18

angular.io

Website for the Angular project (see github.com/angular/angular for the project repo)
HTML
1,032
star
19

angular2-seed

TypeScript
1,011
star
20

tsickle

Tsickle — TypeScript to Closure Translator
TypeScript
893
star
21

material.angular.io

Docs site for Angular Components
TypeScript
889
star
22

di.js

Dependency Injection Framework for the future generations...
JavaScript
822
star
23

react-native-renderer

Use Angular and React Native to build applications for Android and iOS
TypeScript
789
star
24

vscode-ng-language-service

Angular extension for Visual Studio Code
TypeScript
777
star
25

dgeni

Flexible JavaScript documentation generator used by AngularJS, Protractor and other JS projects
TypeScript
770
star
26

angular-cn

Chinese localization of angular.io
Pug
761
star
27

router

The Angular 1 Component Router
JavaScript
667
star
28

angular-electron

Angular2 + Electron
TypeScript
610
star
29

devkit

549
star
30

bower-material

This repository is used for publishing the AngularJS Material v1.x library
JavaScript
506
star
31

watchtower.js

ES6 Port of Angular.dart change detection code.
JavaScript
410
star
32

preboot

Coordinate transfer of state from server to client view for isomorphic/universal JavaScript web applications
TypeScript
384
star
33

angular-hint

run-time hinting for AngularJS applications
JavaScript
368
star
34

angular-bazel-example

MOVED to the bazel nodejs monorepo 👉
TypeScript
350
star
35

builtwith.angularjs.org

builtwith.angularjs.org
HTML
271
star
36

protractor-accessibility-plugin

Runs a set of accessibility audits
JavaScript
263
star
37

angularjs.org

code for angularjs.org site
JavaScript
260
star
38

angular-update-guide

An interactive guide to updating the version of Angular in your apps
TypeScript
251
star
39

webdriver-manager

A binary manager for E2E testing
TypeScript
225
star
40

bower-angular

Bower package for AngularJS
CSS
224
star
41

angular-ja

repository for Japanese localization of angular.io
TypeScript
212
star
42

ngSocket

WebSocket support for angular
JavaScript
204
star
43

peepcode-tunes

Peepcode's Backbone.js Music Player Reimplemented in AngularJS
JavaScript
204
star
44

clutz

Closure to TypeScript `.d.ts` generator
Java
163
star
45

benchpress

JavaScript
160
star
46

code.angularjs.org

code.angularjs.org
153
star
47

ngcc-validation

Angular Ivy library compatibility validation project
TypeScript
146
star
48

dgeni-packages

A collection of dgeni packages for generating documentation from source code.
JavaScript
143
star
49

bower-angular-route

angular-route bower repo
JavaScript
143
star
50

atscript-playground

A repo to play with AtScript.
JavaScript
141
star
51

bower-angular-animate

Bower package for the AngularJS animation module
JavaScript
137
star
52

protractor-cookbook

Examples for using Protractor in various common scenarios.
TypeScript
130
star
53

diary.js

Flexible logging and profiling library for JavaScript
JavaScript
127
star
54

bower-angular-i18n

internationalization module for AngularJS
JavaScript
125
star
55

ts-minify

A tool to aid minification of Typescript code, using Typescript's type information.
TypeScript
119
star
56

closure-demo

TypeScript
114
star
57

ngMigration-Forum

109
star
58

watScript

The next generation JavaScript language that will kill ALL the frameworks!
101
star
59

material-adaptive

Adaptive template development with Angular Material
JavaScript
101
star
60

bower-angular-sanitize

angular-sanitize bower repo
JavaScript
99
star
61

code-of-conduct

A code of conduct for all Angular projects
99
star
62

clang-format

Node repackaging of the clang-format native binary
Python
97
star
63

tactical

Data access library for Angular
TypeScript
93
star
64

bower-angular-resource

angular-resource bower repo
JavaScript
92
star
65

dashboard.angularjs.org

AngularJS Dashboard
JavaScript
89
star
66

angular-jquery-ui

jQueryUI widgets wrapped as angular widgets
JavaScript
88
star
67

bower-angular-mocks

angular-mocks.js bower repo
JavaScript
87
star
68

bower-angular-cookies

angular-cookies bower repo
JavaScript
85
star
69

issue-zero

TypeScript
82
star
70

bower-angular-touch

JavaScript
79
star
71

templating

Templating engine for Angular 2.0
JavaScript
76
star
72

a

Library for annotating ES5
JavaScript
67
star
73

material-icons

Common resources for material design in AngularJS
66
star
74

vladivostok

TypeScript
65
star
75

dev-infra

Angular Development Infrastructure
JavaScript
65
star
76

bower-angular-messages

JavaScript
63
star
77

angular-component-spec

Specification for reusable AngularJS components
61
star
78

ci.angularjs.org

ci.angularjs.org CI server scripts
Shell
60
star
79

projects

github reference application for Angular 2.0
JavaScript
58
star
80

codelabs

55
star
81

code.material.angularjs.org

Documentation site for AngularJS Material
HTML
50
star
82

material-tools

Tools for AngularJS Material
TypeScript
47
star
83

jasminewd

Adapter for Jasmine-to-WebDriverJS
JavaScript
46
star
84

material-update-tool

Standalone update tool for updating Angular CDK and Material
TypeScript
46
star
85

material-builds

Build snapshots for @angular/material
JavaScript
45
star
86

material2-docs-content

Docs content for @angular/material
HTML
39
star
87

cdk-builds

Angular CDK builds
JavaScript
38
star
88

benchpress-tree

A reference implementation of a benchpress deep-tree benchmark as seen in Angular
JavaScript
37
star
89

router-builds

@angular/router build artifacts
JavaScript
36
star
90

angular-ko

HTML
36
star
91

prophecy

Deferred/Promise for AngularJS 2.0
JavaScript
36
star
92

answers-app

TypeScript
36
star
93

assert

A runtime type assertion library.
JavaScript
35
star
94

ngo

TypeScript
34
star
95

protractor-console-plugin

Checks the browser log after each test for warnings and errors
JavaScript
34
star
96

examples

TypeScript
33
star
97

introduction-to-angular

TypeScript
33
star
98

microsites

Master repository for sites on the angular.io subdomains (universal.angular.io, material.angular.io, etc)
HTML
29
star
99

core-builds

@angular/core build artifacts
JavaScript
29
star
100

ngtools-webpack-builds

Build artifacts for @ngtools/webpack
JavaScript
28
star