Skip to content

DenysVuika/ng2samples-material

Repository files navigation

Angular 2 with Material Design Lite

This repository holds basic project that can be used as a quick start template when learning and prototyping with Angular 2, TypeScript and Material Design Lite.

Prerequisites

Node.js and npm are essential to Angular 2 development.

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

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

Create a new project based on the template

Clone this repo into new project folder (e.g., ng2-app).

git clone https://github.com/DenisVuyka/ng2samples-material ng2-material
cd ng2-material

Discard everything "git-like" by deleting the .git folder.

rm -rf .git  // non-Windows
rd .git /S/Q // windows

Create a new git repo

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"

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

Grab its address (e.g. https://github.com/<my-org>/ng2-material.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:

Attention Windows Developers: You must run all of these commands in administrator mode.

npm install
npm start

The npm start command first compiles the application, then simultaneously re-compiles and runs the wsrv web 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 tsc - runs the TypeScript compiler once.
  • npm run tsc: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 wsrv, a light-weight, static file server with excellent support for Angular apps that use routing.
  • npm run typings - runs the typings tool.
  • npm run postinstall - called by npm automatically after it successfully completes package installation. This script installs the TypeScript definition files this app requires.