{"_id":"5546245d6bea270d0047d4cb","project":"5511b00d316c512300151ccf","user":"5511afda316c512300151cce","__v":70,"category":{"_id":"5511b00e316c512300151cd3","__v":5,"pages":["5511b00e316c512300151cd5","5546245d6bea270d0047d4cb","554641183dca710d00464754","5586b99f867b5e0d0006c4b8","55891e38060aef190086aace"],"version":"5511b00d316c512300151cd2","project":"5511b00d316c512300151ccf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-24T18:42:22.203Z","from_sync":false,"order":0,"slug":"quickstart","title":"Quickstart"},"githubsync":"","version":{"_id":"5511b00d316c512300151cd2","project":"5511b00d316c512300151ccf","__v":11,"createdAt":"2015-03-24T18:42:21.658Z","releaseDate":"2015-03-24T18:42:21.658Z","categories":["5511b00e316c512300151cd3","55462d123dca710d0046471b","55462d1e35b2240d008389f1","55462ee63dca710d0046471c","5586aedcd23ef40d00de6e95","5586aef0f8942c0d00293dd3","5586bc28867b5e0d0006c4bc","5586bce4f8942c0d00293ddf","5586c209f8942c0d00293def","5587d09eeb5f2421003f9781","558ba534cf331f23002046cf"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-03T13:36:29.718Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"By default, Angular Express kickstarts a modern Angular 1.x application that features:\n\n- automatic compilation of ES6 with [Babel](https://babeljs.io/)\n- pre-configured package management using [jspm](http://jspm.io/)\n- dynamic module loading using the [SystemJS dynamic ES6 loader](https://github.com/systemjs/systemjs)\n- pre-configured unit testing with [karma](http://karma-runner.github.io/), [mocha](http://mochajs.org/), [chai](http://chaijs.com/) and [PhantomJS](http://phantomjs.org/)\n- powerful built-in server based on [Express 4](http://expressjs.com/) and [Harp](http://harpjs.com/) with preprocessor support for [Jade](http://jade-lang.com/), [Markdown](http://daringfireball.net/projects/markdown/), [EJS](http://www.embeddedjs.com/), [Coffeescript](http://coffeescript.org/), [Sass](http://sass-lang.com/), [LESS](http://lesscss.org/) and [Stylus](https://learnboost.github.io/stylus/).\n- compile to HTML, CSS & JavaScript and host it anywhere\n\nFirst install the Angular Express CLI tool:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ npm install -g ngx-cli\",\n      \"language\": \"shell\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\nthen use `ngx init` to kickstart your new project:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# Create a project directory\\n$ mkdir new-project\\n$ cd new-project\\n\\n# Initialize a new project\\n$ ngx init\\n\\n# Install project dependencies\\n$ npm install\\n$ jspm install\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThe default boilerplate comes with powerful pre-configured development tools so you can start working on your application immediately:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# Start the development server that uses jspm and systemjs\\n# to dynamically load all scripts\\n$ npm run development-server\\n\\n# Run unit tests\\n$ npm test\\n\\n# Build all scripts to a minified bundle\\n$ npm build\\n\\n# Start a production server that uses a minified bundle\\n# of the scripts\\n$ npm run production-server\\n\\n# Compile a static version of your project to dist directory\\n$ npm run compile\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n## Start the development server\n\nFrom the root of your project, run:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# Start server in development mode\\n$ npm run development-server\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nand navigate your browser to `http://localhost:9000`.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/77fvl2hYSvuUIaYl5n4i_ngx-boilerplate-default-running.png\",\n        \"ngx-boilerplate-default-running.png\",\n        \"834\",\n        \"720\",\n        \"#4196af\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nIf you open up the console and refresh the page, you will see that jspm dynamically loads all the required scripts.\n\nSourcemaps are available to make debugging as convenient as possible.\n\n## Start the production server\n\nFrom the root of your project, run:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# Build a minified script bundle\\n$ npm run build\\n\\n# Start server in production mode\\n$ npm run production-server\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nand navigate your browser to `http://localhost:9000`.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/SKnxmOmjQ6KvEMEFWpPQ_ngx-boilerplate-default-running.png\",\n        \"ngx-boilerplate-default-running.png\",\n        \"834\",\n        \"720\",\n        \"#4196af\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nNow open up the console again and refresh the page. You will notice that all script requests have been replaced by one request to `app/build.js`.\n\n## Compile your project to a static website\n\nFrom the root of your project, run:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ npm run compile\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nand a static version of your project will be generated in the `dist` directory.\n\nYou can host this static version on any HTTP server.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"If you use [HTML5 mode](https://docs.angularjs.org/guide/$location) in Angular, you will need to configure your server to rewrite URL's.\"\n}\n[/block]\n## But wait, there is more!\n\nAfter kickstarting your project you can easily add small Angular Express components on top of it:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# Add a component to handle ui-router state-not-found events\\n$ ngx install angular-ui-router-state-not-found-handler\\n\\n# Add a component to handle ui-router state-change errors\\n$ ngx install angular-ui-router-state-change-error-handler\\n\\n# Add a component to customize Bootstrap 3 using LESS\\n$ ngx install less-custom-bootstrap3\\n\\n# Add some components that contain boilerplate to create ui-router states\\n$ ngx install angular-ui-router-component src/components/homepage\\n$ ngx install angular-ui-router-component src/components/about\\n$ ngx install angular-ui-router-component src/components/contact\\n\\n$ ...\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nand import them in your Angular application as ES6 modules:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import angular from 'angular';\\n\\nimport errorHandler from 'components/angular-ui-router-state-change-error-handler/_build/index';\\nimport homepage from 'components/hompage/_build/index';\\nimport about from 'components/about/_build/index';\\nimport contact from 'components/contact/_build/index';\\n\\n/**************************************************************************\\n * Define Angular application\\n *************************************************************************/\\n\\nvar ngModule = angular.module('app', []);\\n\\nngModule.run(function () {\\n  console.log('Angular bootstrapped!');\\n});\\n\\n/**************************************************************************\\n * Initialize components and pass component specific options\\n *************************************************************************/\\n\\nerrorHandler(ngModule, { baseUrl: '/components/angular-ui-router-state-change-error-handler' });\\nhomepage(ngModule, { baseUrl: '/components/homepage' });\\nabout(ngModule, { baseUrl: '/components/about' });\\ncontact(ngModule, { baseUrl: '/components/contact' });\\n\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\nto scaffold entire applications in just seconds!\n\nEach component can accept component specific options making them highly reusable and flexible. In the example above, components are passed a `baseUrl` to prepend to links in the view templates.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Once your application has been scaffolded, you can start adding your own code without having to worry about Angular Express.\\n\\nAngular Express is not tied to your project or does not create hidden files in your repository. There are no dependencies either. It scaffolds the code for you and then backs off. No strings attached.\\n\\nIf, at any stage in your project, you want to add an additional existing component, you can run `ngx install` from the root of your project to install as many additional components as you like.\"\n}\n[/block]\n\n\n## In short\n\nAngular Express allows you to kickstart Angular applications by:\n\n- initializing a **boilerplate** using `ngx init`\n- adding components to your application using `ngx install`\n\nSimple. Fast. Clean.\n\n## What's next?\n\n- [Why Angular Express?](doc:why-angular-express) \n- [Why not use Yeoman?](doc:why-not-use-yeoman)\n\n## Popular\n\n- [Learn more about the default Angular 1.x web application boilerplate](https://github.com/ngx-boilerplates/default)","excerpt":"","slug":"quick-example","type":"basic","title":"Quick example"}

By default, Angular Express kickstarts a modern Angular 1.x application that features:

Lace Boot Snow Shortie MOUNTREK Black up Ii Lisa Women's First install the Angular Express CLI tool:

Shell Boot Lisa Ii Shortie Black Women's Lace Snow MOUNTREK up ·
$ npm install -g ngx-cli

then use ngx init to kickstart your new project:

# Create a project directory
$ mkdir new-project
$ cd new-project

Shortie Snow Boot up Lace Ii Lisa Women's Black MOUNTREK # Initialize a new project
$ ngx init

# Install project dependencies
$ npm install
$ jspm install
Sport Skull Running Shoes Shoes Flowers Nmd 80s RqXpB

The default boilerplate comes with powerful pre-configured development tools so you can start working on your application immediately:

# Start the development server that uses jspm and systemjs
# to dynamically load all scripts
up Lace Shortie Ii Boot MOUNTREK Snow Lisa Women's Black $ npm run development-server

# Run unit tests
$ npm test

Lisa Black Shortie Ii Women's MOUNTREK Boot Snow Lace up # Build all scripts to a minified bundle
$ npm build

# Start a production server that uses a minified bundle
# of the scripts
$ npm run production-server

# Compile a static version of your project to dist directory
$ npm run compile

Start the development server

From the root of your project, run:

# Start server in development mode
$ npm run development-server

and navigate your browser to http://localhost:9000.

If you open up the console and refresh the page, you will see that jspm dynamically loads all the required scripts.

Sourcemaps are available to make debugging as convenient as possible.

Start the production server

From the root of your project, run:

# Build a minified script bundle
$ npm run build

# Start server in production mode
$ npm run production-server

and navigate your browser to http://localhost:9000.

Now open up the console again and refresh the page. You will notice that all script requests have been replaced by one request to app/build.js.

Compile your project to a static websiteWomens Black INC International Classic Concepts Piano Pointed Pumps Toe PSORanSx

From the root of your project, run:

$ npm run compile

and a static version of your project will be generated in the dist directory.

You can host this static version on any HTTP server.

Lace Snow Shortie Women's MOUNTREK Ii Black Lisa Boot up

If you use HTML5 mode in Angular, you will need to configure your server to rewrite URL's.

But wait, there is more!

After kickstarting your project you can easily add small Angular Express components on top of it:

# Add a component to handle ui-router state-not-found events
$ ngx install angular-ui-router-state-not-found-handler

# Add a component to handle ui-router state-change errors
$ ngx install angular-ui-router-state-change-error-handler

# Add a component to customize Bootstrap 3 using LESS
$ ngx install less-custom-bootstrap3

# Add some components that contain boilerplate to create ui-router states
$ ngx install angular-ui-router-component src/components/homepage
$ ngx install angular-ui-router-component src/components/about
$ ngx install angular-ui-router-component src/components/contact

Black Lisa MOUNTREK Women's Ii Lace Boot Shortie up Snow $...

and import them in your Angular application as ES6 modules:

import angular from 'angular';

import errorHandler from 'components/angular-ui-router-state-change-error-handler/_build/index';
import homepage from 'components/hompage/_build/index';
import about from 'components/about/_build/index';
import contact from 'components/contact/_build/index';

/**************************************************************************
 * Define Angular application
 *************************************************************************/

var ngModule = angular.Shortie Lisa Black MOUNTREK Snow Women's Boot up Ii Lace module('app'Long REACTION Oxford Sew Men's Brown Cole Kenneth 4PwqIB8I, []);

ngModule.run(function () {
  console.log('Angular bootstrapped!');
});

/**************************************************************************
Lace Boot up Black Women's Ii MOUNTREK Snow Lisa Shortie * Initialize components and pass component specific options
 *************************************************************************/

errorHandler(ngModule, { baseUrl: '/components/angular-ui-router-state-change-error-handler'Low Sneakers Fashion Rise Morrison Sapphire naturalizer Oxgaw5P5q });
homepage(ngModule, { baseUrl: '/components/homepage' });
about(ngModule, { Black Women's Snow Ii Lace Lisa Boot MOUNTREK Shortie up baseUrl: up Lisa Snow Shortie Ii Boot Black Women's Lace MOUNTREK '/components/about' });
contact(Lace Black up Snow Shortie Women's Lisa Ii MOUNTREK Boot ngModule, { baseUrl: '/components/contact' });

to scaffold entire applications in just seconds!

Each component can accept component specific options making them highly reusable and flexible. In the example above, components are passed a baseUrl to prepend to links in the view templates.

Once your application has been scaffolded, you can start adding your own code without having to worry about Angular Express.

Angular Express is not tied to your project or does not create hidden files in your repository. There are no dependencies either. It scaffolds the code for you and then backs off. No strings attached.

If, at any stage in your project, you want to add an additional existing component, you can run ngx install from the root of your project to install as many additional components as you like.

In short

Angular Express allows you to kickstart Angular applications by:

  • initializing a boilerplate using ngx init
  • adding components to your application using ngx install

Simple. Fast. Clean.

What's next?