how can I import a js file in angular 6. I tried to implement a navbar and it contains js functions. thanks!!!
I Add my js file called nav.js
\"scripts
You should include on index.html, e.g:
A random project
On this case I included cartodb.js library, then for use cartodb.js on any component, or service I use:
declare var cartodb: any;
At the beginning of any file (Component, Service, etc).
Note change cartodb by the name of the library you will use, for example for jquery is:
declare var jquery:any;
declare var $ :any;
You should have something like this:
import { Injectable } from '@angular/core';
// Other imports...
declare var cartodb: any;
@Injectable()
export class ARandomService {
}
P.s Search if the code you want to use doesn't exist in npm.