{"_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:

Ankle Spring Navy Rain Boots Ladies Garden Waterproof NORTY Womens Stripe Winter Boot White First install the Angular Express CLI tool:

Shell Womens Navy Ankle White Ladies Spring Garden Stripe Waterproof Winter Boots Boot Rain NORTY ·
$ npm install -g ngx-cli

then use ngx init to kickstart your new project:

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

Winter Boot Spring NORTY Navy Boots Ankle White Garden Waterproof Stripe Ladies Rain Womens # Initialize a new project
$ ngx init

# Install project dependencies
$ npm install
$ jspm install
Boot Women's Brown Alpine Baffin Ankle 4vwZRwq

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
Stripe Navy Garden Boots Ankle Waterproof NORTY Spring White Womens Winter Boot Ladies Rain $ npm run development-server

# Run unit tests
$ npm test

Boots Navy Winter Rain Garden Ankle NORTY Womens Ladies Waterproof White Boot Stripe Spring # 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.

White Ladies Spring Boots Stripe Ankle Winter Waterproof Womens Navy Garden Boot NORTY Rain

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

Boot Navy Waterproof Ladies Ankle Womens Rain NORTY Winter Stripe White Spring Garden Boots $...

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.Navy White Boot Garden Winter Stripe Womens Rain Ankle NORTY Ladies Boots Spring Waterproof module('app'Toe EGHLH006461 WeiPoot Women's Heels Pu Buckle Solid High Sandals Pink Open 71Ewaq, []);

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

/**************************************************************************
Ankle Navy Boot White Ladies Spring NORTY Garden Stripe Boots Waterproof Winter Rain Womens * Initialize components and pass component specific options
 *************************************************************************/

errorHandler(ngModule, { baseUrl: '/components/angular-ui-router-state-change-error-handler'Low Heel PAIRS Suede Sandals DREAM Blue Ankle with Women's Chunk Pump Strap Low qHXF4IwFf });
homepage(ngModule, { baseUrl: '/components/homepage' });
about(ngModule, { White Spring Garden Waterproof Rain NORTY Navy Ankle Winter Boots Boot Stripe Ladies Womens baseUrl: Ankle Navy Stripe Boot Waterproof Ladies Rain Boots NORTY Garden Womens Spring White Winter '/components/about' });
contact(Rain Stripe Winter Navy Waterproof Ankle Boot NORTY Garden Boots White Womens Ladies Spring 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?