Help to integrate Angular 4 with external library

0

Good morning, I am creating an application with Angular 4 and I want to be able to integrate libraries js to the solution as they are:

1- link

2- link

However, we have not been able to incorporate them, despite placing the library in the .angular-cli.json file.

What else should we configure to work with these libraries from angle 4?

    
asked by Duany 08.11.2017 в 16:09
source

1 answer

0

For the use of non-angular libraries, you have 2 options for importing and 1 for use.

  

Import the script.

// En el index.html

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

// O bien en .angular-cli.json

{
    "scripts": [
      "../node_modules/jquery/dist/jquery.min.js"
    ]
}
  

Use in any TypeScript file declaring the main variable of your library at the beginning of the file after the imports.

declare var $: any; // Ejemplo para jQuery
    
answered by 26.12.2017 в 22:20