Issue
I have a JavaScript file called abc.js that has a 'public' function called xyz(). I want to call that function in my Angular project. How do I do that?
Solution
Refer the scripts inside the angular-cli.json (angular.json when using angular 6+) file.
"scripts": [
"../path"
];
then add in typings.d.ts (create this file in src if it does not already exist)
declare var variableName:any;
Import it in your file as
import * as variable from 'variableName';
Answered By - Aravind
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.