Updated to use Angular 4, Angular CLI 1.0.4, and the latest d3. I need to get around to updating the map component and overall validation of the approach. Since Angular wants to abstract the DOM from the developer, there's a way to get D3 access to it and I'll get it right soon.
Simple example of creating a reusable D3 chart component.
See http://keathmilligan.net/create-reusable-chart-components-with-angular-2-and-d3-js-version-4/ for more information about this example.
Original commit - trying to adapt this approach to create a reusable map component... and then read data from an API.
12/30/2016 - I just learned that shared components can (at least enforced by cli) only be exposed via modules. This new version adds a shared module and exposes the components via that module.
I've also reinstalled d3 using typings using the following commands:
npm install d3 --save
npm install @types/d3 --save-dev
This project was originally generated with angular-cli version 1.0.0-beta.17. It was then updated to use version 1.0.0-beta.24
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
.
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.
Before running the tests make sure you are serving the app via ng serve
.
Run ng github-pages:deploy
to deploy to Github Pages.
To get more help on the angular-cli
use ng --help
or go check out the Angular-CLI README.