2

How can i use third party library in angular 4? Normally i used code below :

<html>
    <head>
        <title>Bootstrap CDN Simple Example</title>
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <h1> Bootstrap CDN Simple Complete HTML Example</h1>    
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
        <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
    </body>
</html>

1 Answer 1

1

There are two ways to achieve that.

You can simply add the <script> to your index.html file, like you described above and then access it through declare var google: any; (or whatever name your library has).

Here's an example for using google maps in angular.

Or you can install the library from npm (with the accoriding types) and simply import it like this:

import * as _ from "lodash";

Here's an example for this approach.

Sign up to request clarification or add additional context in comments.

Comments