Coder Social home page Coder Social logo

cayres / angular2_02142017 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from training4developers/angular2_02142017

0.0 1.0 0.0 998 KB

Class Files for Advanced Angular 2 + TDD

Home Page: http://www.t4d.io

License: MIT License

JavaScript 62.11% HTML 3.31% CSS 0.27% TypeScript 34.31%

angular2_02142017's Introduction

Welcome to Advanced Angular 2 with TDD

Instructor

Eric Greene - http://t4d.io - LinkedIn

Schedule

Class:

  • Today & Tomorrow: 9am to 5pm

Breaks:

  • Morning: 10:25am to 10:35am
  • Lunch: Noon to 1pm
  • Afternoon #1: 2:15pm to 2:25pm
  • Afternoon #2: 3:40pm to 3:50pm

Course Outline

Day 1

  • Quick Assessment
  • Angular 2 Overview
  • Unit Testing Overview
  • TDD Synchronous Code
  • Pipes
  • Services
  • Components

Day 2

  • JavaScript Asynchronous Programming Review
  • TDD Asynchronous Code
  • HTTP Services
  • Promises & Observables

Links

Instructor's Resources

Other Resources

Overview

This is a simple CRUD (create, read, update & delete) application demonstrating the essentials of Angular 2 including HTTP services, routing, forms, composing components and unit testing. The base project configuration was originally adapted from the Angular 2 Webpack Starter project, and has been updated to Webpack 2 with help from this project Angular Class - Angular 2 Webpack Stater.

Application Setup

Step 1. Install Node.js version 7 or higher. To install Node.js click here.

Step 2. Download this repository from here. Extract the zip file to a working folder on your system.

Step 3. Open a terminal window, change to the folder where you extracted the zip file. You should see a package.json file in the folder.

On Windows, the terminal is called "Node.js Command Prompt". This will command prompt will contain the proper paths for Node.js development. DO NOT RUN the Node.js program. Click the icon named "Node.js Command Prompt". For Mac users, the Mac terminal is all you need.

Step 4. From the terminal, run the following command:

$ npm i && npm start

It could take a few minutes for this command to complete. If you have connection issues due to a proxy server, please edit the .npmrc file per the instructions in those files. Then re-run the command above.

This set has been completed successfully when you receive the following message:

[0] Child html-webpack-plugin for "index.html":
[0]     chunk    {0} index.html 541 kB [entry] [rendered]
[0]         [0] ./~/lodash/lodash.js 540 kB {0} [built]
[0]         [1] (webpack)/buildin/global.js 509 bytes {0} [built]
[0]         [2] (webpack)/buildin/module.js 517 bytes {0} [built]
[0]         [3] ./~/html-webpack-plugin/lib/loader.js!./src/index.html 644 bytes {0} [built]
[0] webpack: Compiled successfully.

This terminal window is now running the web server, a second terminal window will need to be opened to run additional terminal commands.

Step 5. Open a web browser, and navigate to http://localhost:5000. The Angular 2 web application should load and be usable.

To Modify the Web Application

Step 6. Open your favorite text editor (such as Atom or Visual Studio Code), and modify the files in the src folder. When file changes are saved, webpack will automatically transpile and bundle the application code and assets, and deploy it to the dist folder. To see the changes, reload your web browser.

The solution is preconfigured for IntelliJ IDEA and Webstorm for ESLint and TSLint. Also, automatic transpilation for TypeScript and SASS has been disabled. All transpilation should be performed via Webpack from the command line.

Visual Studio Code supports TypeScript out of the box, but several additional extensions will greatly enhance the development experience. Install the following extensions:

  • ESLint: dbaeumer.vscode-eslint
  • HTMLHint: mkaufman.HTMLHint
  • MarkDown Lint: DavidAnson.vscode-markdownlint
  • Sass Lint: glen-84.sass-lint
  • TSLint: eg2.tslint

Atom does not support TypeScript out of the box. Please install the following packages to enhance the development experience. To install an extension from the menu bar, go to Packages -> Settings View -> Install Packages/Themes. Search for the following packages individually, and install them.

  • atom-typescript
  • linter
  • linter-eslint
  • linter-htmlhint
  • linter-sass-lint
  • linter-tslint
  • platformio-ide-terminal
apm config set proxy "http://localhost:8080"

apm config set https_proxy "http://localhost:8080"

apm config set strict-ssl false

Restart Atom, then re-attempt to install the atom-typescript package again.

Running Unit Tests

From a terminal run the following command:

npm test

The results of the unit tests and code coverage report will be displayed in the terminal window.

To view the HTML version of the code coverage report, open the index.html in the reports/coverage/browser-name folder with a web browser.

NPM Scripts Command Reference

From a terminal, in the root project folder (where the package.json file exists), the following commands can be executed to perform various project development tasks.

  • npm start - removes the dist folder, builds and deploys the web app, and starts the web app and the rest app in production mode
  • npm test - starts karma to run the unit tests once
  • npm run clean - removes the dist folder
  • npm run dev - starts the web app in development mode
  • npm run prod - starts the web app in production mode
  • npm run web-dev - starts the webpack dev server in development mode (JSON server is not started)
  • npm run web-prod - starts the webpack dev server in production mode (JSON server is not started)
  • npm run rest - starts the rest server
  • npm run webpack-dev:w - runs webpack in development mode under watch mode so web app file changes are automatically processed, and deployed to the dist folder
  • npm run webpack-dev - runs webpack in development mode so web app file changes are processed once, and deployed to the dist folder
  • npm run webpack-prod - runs webpack in production mode so web app file changes are processed once, and deployed to the dist folder
  • npm run webpack-test - runs webpack in test mode so web app file changes are processed once, and deployed to the dist folder
  • npm run tdd - run application in test driven development mode, karma will re-run tests on each file save

To learn more about the Angular 2/WebPack/TypeScript/Karma configuration, click here.

Useful Resources

angular2_02142017's People

Contributors

ericwgreene avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.