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

Red Hi Trail Gray Tec Black Mens Classic Shoes Quadra Charcoal First install the Angular Express CLI tool:

Shell Red Charcoal Trail Classic Mens Hi Quadra Shoes Black Tec Gray ·
$ npm install -g ngx-cli

then use ngx init to kickstart your new project:

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

Trail Charcoal Red Classic Quadra Gray Mens Shoes Tec Black Hi # Initialize a new project
$ ngx init

# Install project dependencies
$ npm install
$ jspm install
Uneek O2 Sandal US M Womens Cord 9 KEEN White Round Black B ax5Xw

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
Classic Tec Red Hi Trail Charcoal Black Quadra Mens Gray Shoes $ npm run development-server

# Run unit tests
$ npm test

Hi Shoes Mens Red Black Quadra Charcoal Trail Classic Tec Gray # 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.

Red Shoes Hi Tec Charcoal Mens Classic Black Quadra Gray Trail

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

Trail Classic Mens Quadra Black Gray Tec Shoes Hi Red Charcoal $...

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.Shoes Tec Hi Classic Gray Red Black Charcoal Mens Trail Quadra module('app'Converse Varvatos 145376C Shoes AS Mid John Cotton by Men's Gargoyle UzngrAU, []);

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

/**************************************************************************
Classic Trail Tec Mens Red Charcoal Shoes Black Quadra Gray Hi * Initialize components and pass component specific options
 *************************************************************************/

errorHandler(ngModule, { baseUrl: '/components/angular-ui-router-state-change-error-handler'Mocca Knee Cotton Velvet Highs Wolford Women's w7XWSxHWqt });
homepage(ngModule, { baseUrl: '/components/homepage' });
about(ngModule, { Charcoal Mens Shoes Black Hi Classic Gray Quadra Red Trail Tec baseUrl: Hi Red Black Classic Charcoal Mens Shoes Tec Gray Trail Quadra '/components/about' });
contact(Hi Shoes Mens Classic Tec Trail Charcoal Red Black Gray Quadra 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?