In script.js
;(function($, window, undefined) {
$.fn.myFunction = function() {/*codes*/};
}(jQuery, window));
In index.html
<head>
....
<script src="assets/js/script.js"></script>
</head>
In component.ts
ngAfterViewInit(){
myFunction();
}
I have error - Cannot find name 'myFunction'