User interface from Geoserve web service data.
How to preview the project in your browser:
-
Install NPM dependencies
npm install
-
Preview in a browser
ng serve -o
The application should open (flag -o) in your browser.
This project is intended to be deployed as an NPM package. Building in this sense requires packaging the application from the Angular source code, and then publishing that package to npm earthquake-geoserve-ui.
Package from the Angular source using ng-packgr. This script packages the application into an npm distributable that can be published.
$ npm run package
The bundled application in the dist-npm
folder should be tagged and pushed to npm so that it can be imported into other projects.
$ npm publish dist-npm --tag <version>
The package can now be installed via npm by referencing the earthquake-geoserve-ui
package name.
$ npm install earthquake-geoserve-ui@<version>
Follow these steps to use any of the geoserve components in your application.
The GeoserveOutputModule
contains the following component selectors:
- geoserve-admin-region
- geoserve-authoritative-region
- geoserve-nearby-places
- geoserve-neic-catalog-region
- geoserve-neic-response-region
- geoserve-offshore-region
- geoserve-tectonic-summary-region
To use the component selectors you must import the correct modules and services into your application.
-
Install the earthquake-geoserve-ui project
npm install earthquake-geoserve-ui
-
Import the
GeoserveOutputModule
andGeoserveCoreModule
from theearthquake-geoserve-ui
/** app.module.ts */ import { GeoserveCoreModule, GeoserveOutputModule } from 'earthquake-geoserve-ui'; ... imports: [ GeoserveCoreModule.forRoot(), GeoserveOutputModule ]
-
Add the desired geoserve components to your component template
/* some.component.html */ <geoserve-admin-region></geoserve-admin-region> <geoserve-nearby-places></geoserve-nearby-places> <geoserve-tectonic-summary-region></geoserve-tectonic-summary-region>
-
Import the
CoordinatesService
and use thesetCoordinates()
method to set the coordinate location for the geoserve components. The geoserve components are subscribed to coordinate changes and will trigger a region/place change when the coordinates are updated./* some.component.ts */ import { CoordinatesService } from 'earthquake-geoserve-ui'; ... constructor( public coordinatesService: CoordinatesService ) { } ... this.coordinatesService.setCoordinates({ longitude: 35, latitude: -105 });
-
With the coordinates set the geoserve components should now display region/place information for the selected coordinates.
This project was generated with Angular CLI version 1.5.5.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.