/angular-cli-universal

angular 2 v4 universal

Primary LanguageHTML

AngularCliUniversal

Build Status Greenkeeper badge dependencies Status devDependencies Status Codacy Badge

This project was generated with Angular CLI version 1.0.0-rc.1.

Development mode

  • Terminal 1: npm run watch:all
  • Wait for the build to finish
  • Terminal 2: npm run server

Build with AoT

npm run build:all:aot
npm run server

Build with AoT and serviceworker

Add this script to the body of your index.html

<script>
  if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('/service-worker.js').then(function(registration) {
      console.log('Service Worker registered');
    }).catch(function(err) {
      console.log('Service Worker registration failed: ', err);
    });
  }
</script>

And run these commands

npm run build:all:aot
npm run sw
npm run server

Based on and huge thanks to @FrozenPandaz: FrozenPandaz/ng-universal-demo

Based on and huge thanks to @robwormald: robwormald/ng-universal-demo