javascriptangularnpmangular5timesheet.js

How to use javaScript TimeSheet Plugin in Angular 5


In my project I need to use exactly the same plugin in Angular 5 as this TimeSheet https://www.jqueryscript.net/time-clock/Table-Based-jQuery-Calendar-Schedule-Plugin-TimeSheet.html. But I haven't found a module like this and need to import and use it in project. How can I import and use it in my project?


Solution

  • Just attach TimeSheet javaScript file and jQuery to the scripts in your angular configuration file.

    scripts: [ 
        'yourRelativePath/TimeSheet.js' 
    ]
    

    Then declare var $ to force compiler not to argue on the $ variable or add @types/jQuery into devDependencies:

    declare var $: JQueryStatic;
    

    and

    npm install @types/jquery --save-dev
    

    With Angular/Typescript you can use every Javascript file, cause TypeScript files will be compiled into Javascript, one thing is just to let compiler to pass your code.