Skip to content

Angular JS Environment

rrowlands edited this page Jan 14, 2019 · 10 revisions

Running a local dev front-end environment for Angular 2+

GeoPrism uses the cargo-run launch to start a local dev server. To develop in a local Angular 2+ environment you must:

  1. make sure ng2-dev is added to the list of profiles in the launch.
  2. CD into the geoprism/geoprism-web/src/main/ng2 dirctory and run 'npm run build'.

This should result in your Angular 2+ source being read on localhost so you can see changes without having to restart the server.

IMPORTANT NOTE: After the server is started and you visit the app you will likely get errors saying polyfills.js, vendor.js, app.js can't be found. This is due to a cross domain restriction. To fix it right click on the error file in the console and copy the link address. Past the link address into a new tab. You're trying to open the file directly. This will give you a security warning which you need to accept as an allowed exception. Once done your browser session will register https://localhost as safe and the page should work.

Compiling Angular 2+ source manually

In general, our maven tasks should automatically compile the ng2 source. If for some reason you need to compile it manually, here's how you can from command line:

  1. Install nodejs (should come with npm)
  2. cd to the ng2 directory in you web project
  3. From command line run npm install. This will automatically pull all our project's dependencies using the npm package manager.
  4. Install typings: sudo npm install typings --global
  5. Install lodash into typings: typings install lodash
  6. You can now compile the angular source code with npm run build