GithubHelp home page GithubHelp logo

Comments (6)

michielvermeir avatar michielvermeir commented on June 27, 2024

https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad

Something along those lines needs to happen I suppose?

from angular2-nvd3.

ekuusi avatar ekuusi commented on June 27, 2024

That sounds about right I think, at least the error matches. Just in case someone wants a quick temporary fix, I got this to work with AoT with a workaround by copying the components to my own project instead of using the module.

from angular2-nvd3.

michielvermeir avatar michielvermeir commented on June 27, 2024

I was giving it a shot earlier today but I couldn't get ngc to emit .metadata.json files as the article suggests. The whole Angular 2 toolchain is rather befuddling to me.

Maybe I'll try again once I get some free time. Until then, this library is sort of unusable in conjunction with Angular CLI. Any workarounds?

from angular2-nvd3.

ekuusi avatar ekuusi commented on June 27, 2024

Copy all four files from /src/angular2-nvd3 into your own project and replace the "ngOnChanges()" methods with "ngOnChanges(changes?)". Then you can just import the module into your app.module.ts and the component where you want to use the selector, works with AoT.

import { NvD3Module } from '../nvd3/angular2-nvd3.module';
declare var d3: any;

@Component({
	selector: 'app-timeframebarchart',
	template: '<app-nvd3 [options]="options" [data]="data"></app-nvd3>'
})

Of course you also still need to include the separately downloadable nv.d3.css in your project for the styles to be right.

from angular2-nvd3.

michielvermeir avatar michielvermeir commented on June 27, 2024

@ekuusi I had some success in getting this package ready for AOT by changing the tsconfig.json to include "angularCompilerOptions": { "strictMetadataEmit": true } and compile ngc instead of tsc in the package.json.

This requires that you install @angular/compiler-cli as a dev dependency. ngc then emits the necessary .metadata.json files for AOT. I'll look at creating a pull request later. For now I have published an npm package that works for me (i.e. https://www.npmjs.com/package/angular2-nvd3-aot).

from angular2-nvd3.

hendrathings avatar hendrathings commented on June 27, 2024

I close this issue, since I accept Ready for AOT #10

from angular2-nvd3.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.