I am working on an angular project with my friends for our class project and we want a custom Js file with certain methods to be added to our project but adding this to the app.component.html file inside didn't work. How to add the files to the project?
2 Answers
firsfile and secondfile are the member variable of typescript class
Initalise this member var in constructor like this.
this.firstFile= require('./firstfile'); // firstfile.js
this.secondFile= require('./secondfile'); //secondfile.js
now use same as you do in JavaScript after importing module files.
Hope it will help
1 Comment
Sunny Goel
I don't think so is their is any wrong in that . I am also use some protobuffer JavaScript file in my angular project , it run fine. so if you give any negative rating then please explain it why you are giving the negative rating.
angular.jsonfile as explained here github.com/angular/angular-cli/wiki/stories-global-scripts