Bargavikalla

How to use external libraries for AOT in angular2?

Discussion created by Bargavikalla on Sep 10, 2018
Latest reply on Sep 11, 2018 by tsuyu04
  • Environment: Operating system: Ubuntu 16.04 , IDE: Atom

  • Angular version: 2.3.1

  • Browser: [ Chrome 57.0.2987.110 ]

  • Language: [ TypeScript 2.1.6 | ES6 ]

  • Node (for AoT issues): node --version =6.9.5

At the point when do the contents inside contents tag of precise cli.json really get executed amid AOT ?

In one of my segments, I have utilized minified amazon s3 sdk. ('aws-sdk-2.23.0.min.js') In JIT, my application is working fine when I utilize AWS Certified

 

declare let AWS: any;

But in AOT it produces following error:

Cannot read property 'S3' of undefined TypeError: Cannot read property 'S3' of undefined.

angular-cli.json contains following:

{   ...    "apps": [     {      ....       "scripts": [          "aws-sdk-2.23.0.min.js"       ]           }   ]   ... }

Outcomes