Angular template for NSHMP applications.
Repository and Angular documentation:
@ghsc
ScopeIn order to install nshmp-template into an Angular project, you must configure
NPM to be aware of the @ghsc
scope. There are two methods
to do this:
Note: In these two examples, the first uses an URL-encoded path to the nshmp-template project library. The second uses the nshmp-template project ID. Either value can be used with either method.
$ npm config set \
'@ghsc:registry' \
"https://code.usgs.gov/api/v4/projects/ghsc%2Fnshmp%2Fnshmp-template/packages/npm/"
~/.npmrc
# Upstream nshmp-template
@ghsc:registry=https://code.usgs.gov/api/v4/projects/1416/packages/npm/
Note: You may alternatively create a
.npmrc
file in your Angular project with the above info.The NPM configuration may exist in multiple different locations. Learn more about NPM configuration files.
After properly configuring the NPM scope, you can now install nshmp from
the @ghsc
scope.
npm install -S @ghsc/nshmp-template
To include the NSHMP theme and styling to your Angular application either import the stylesheet or update the angular.json file.
Update your Angular main style.scss to import nshmp-template:
Example :@use '~@ghsc/nshmp-template/styles/styles.scss';
Update the angular.json styles
property to include nshmp-template stylesheet:
"styles": [
"node_modules/@ghsc/mnshmp-template/styles/styles.scss"
]
Update the angular.json assets
property to include nshmp-template and USWDS assets:
"assests": [
{
"glob": "**/*",
"input": "node_modules/@ghsc/nshmp-template/assets",
"output": "./assets"
},
{
"glob": "**/*",
"input": "node_modules/uswds/dist/img",
"output": "./assets/img"
},
{
"glob": "**/*",
"input": "node_modules/uswds/dist/fonts",
"output": "./assets/fonts"
}
]
Run npm run start
to view the example application.
Note: Server starts on localhost:4200
See the simple application to see how to use the nshmp-template to create a simple app.
See the plot application to see how to use the nshmp-template to create a plotting app with a control and setting panel.
See the mapping application to see how to use the nshmp-template to create a mapping app with a control and setting panel.
The nshmp-template has a few inputs and outputs.
Example :<nshmp-template
[navigationList]=""
appTitle="My App Title"
(aboutChanged)=""
(controlPanelChanged)=""
(controlsChanged)=""
(mapChanged)=""
(plotChanged)=""
(settingsChanged)=""
>
</nshmp-template>
npm run build
- build applicationnpm run start
- start the example applicationnpm run lint
- lint the projectnpm run lint:fix
- fix linting problems if possible