• Stars
    star
    488
  • Rank 87,259 (Top 2 %)
  • Language
    JavaScript
  • Created over 8 years ago
  • Updated about 7 years ago

Reviews

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

Repository Details

Angular development and testing examples with Babel in Javascript (ES6/ES7).

Angular Babel ESNext Starter

Dependency Status devDependency Status Build Status

This repository shows development and testing techniques with Angular. The application is written in modern Javascript without Typescript. It can be ideal for those who are new to Angular and want to learn how things work and fiddle with Typescript later.

It is a basic CRUD application with authentication, similar to the news site jslive.com. You can see the list of links, add and edit them after you signed in.

If you're looking for Angular in Javascript without Gulp tasks and server side check out angular2-esnext-todomvc

If you're looking for Angular in Typescript check out angular2-webpack-starter

  • Modern Javascript implementation with classes, decorators.
  • Uses Babel to support decorators.
  • Same language constructs can be used as in Typescript (types will be stripped).
  • Bundles files with Webpack.
  • Automates tasks with Gulp.
  • Automatically rebundles and refreshes the browser on changes.
  • Unit testing with Karma and Jasmine.
  • Code coverage for original ES6 code.
  • Includes deployment to Heroku.
  • Linting with ESlint based on Airbnb's styleguide.
  • Layout and namings based on the official Angular 2 style guide

Concepts covered

  • Creating components with directives
  • Communication between child and parent components
  • Dependency injection for services
  • Change detection strategies
  • Using custom pipes in templates
  • Handling HTTP calls
  • Using observables
  • Routing
  • Authentication and restricting access to routes
  • Form handling
  • Using custom validators in forms
  • Internationalization with ngx-translate

Quick Start

git clone https://github.com/blacksonic/angular2-babel-esnext-starter.git
cd angular2-babel-esnext-starter
npm install

gulp serve

It bundles the application, copies the static files and starts the webserver with Nodemon. The transpiled application will have two separate ES5 compatible files: vendor.js for vendor libraries, boot.js for application logic. Server side changes restart the server, client side changes rebundle the Angular application and refresh the page with Livereload.

Note: The application needs at least Node 6+ installed.

Open it in your browser http://localhost:9000 and start coding your first Angular application in Javascript!

Testing

gulp test

Runs tests with Karma and Jasmine. Uses a single entry point (setup.spec.js), which includes all the *.spec.js files and runs the tests inside them. The test files can be found in the client/app folder next to the source files.

Because a clean bundling with Webpack can take multiple seconds, it is not ideal for development to run a clean test run every time. Instead it can run continuously on your development machine.

gulp test-dev

To get a good overview of testing possibilities within Angular read this article.

Workarounds

No more is needed, code can be written as in Typescript!

Read about the details how it is implemented in this article.

Authentication

It is implemented with the router's built-in lifecycle events. For a detailed explanation read this article.

Deployment (to Heroku)

It bundles the client application and copies static files and server files to the dist directory along with package.json. Then it can be commited to the desired location (for example Heroku).

gulp dist

cd dist
git init
git add -A .
git commit -m "Deploy #1" && echo Committed
git push -f [email protected]:angular2-es6-starter.git master

More Repositories

1

awesome-vue-3

A curated list of awesome things related to Vue 3
1,324
star
2

vue-3-playground

Vue 3 Playground packed with all the new features
Vue
509
star
3

angular2-aot-webpack

Angular AOT (Ahead Of Time) offline compilation example with Webpack
JavaScript
313
star
4

babel-webpack-tree-shaking

Tree-shaking example with Babel and Webpack
JavaScript
252
star
5

typescript-webpack-tree-shaking

Tree-shaking example with Typescript and Webpack
JavaScript
145
star
6

angular2-esnext-todomvc

Angular TodoMVC application in Javascript (ES6/ES7).
JavaScript
130
star
7

todomvc-vue-composition-api

TodoMVC built with Vue 3 Composition Api and Vuex
JavaScript
126
star
8

movie-search-vue

Movie search app with the Vue 3 Composition API
Vue
44
star
9

angular2-aot-cli-webpack-plugin

Angular AOT (Ahead Of Time) compilation with Webpack plugin
JavaScript
40
star
10

todomvc-svelte

TodoMVC built with Svelte and Store
JavaScript
38
star
11

todomvc-vue

TodoMVC built with Vue and Vuex
JavaScript
28
star
12

todomvc-react-hooks

TodoMVC built with React Hooks and Redux
JavaScript
24
star
13

ngx-http-test

Angular 2 Http test helper
TypeScript
17
star
14

minesweeper

Minesweeper game built with isomorphic Javascript
JavaScript
14
star
15

todomvc-react

TodoMVC built with React and Redux
JavaScript
6
star
16

node-docker-workflow

Docker workflow for local development and deployment
Makefile
5
star
17

game-of-life

Vue 3 implementation of Conway's Game of Life, with a twist
Vue
4
star
18

todomvc-angular

TodoMVC built with Angular and NgRx
TypeScript
3
star
19

webpack-showcase

Basic setup for Webpack 4 and Babel 7 covering development, testing and deployment.
JavaScript
3
star
20

url-shortener

TypeScript
1
star
21

framework-diff

Comparing the same application written in (Vue, Angular, React, Svelte)
Vue
1
star