I have been following the very beginning of the angular 4 get started. I have completed the entire page here https://angular.io/guide/quickstart. At the end of this I wanted to experiment by adding new external js functionality to play around with gantt charts. This is the external js framework that I want to import into this quickstart project: http://jsgantt.com/. Now my issue is inside of the index.html i follow with adding the js/css files of the jsgantt framework but the angular app is not picking up my script. I have followed this by adding inside the script of angular-cli.json file but its still not working when i follow the how to use guide for jsgantt.js. how to include external js file in angular 4 and call function from angular to js. Can anyone please help me I am completely new to this stuff and have no understanding of the new angular 4 stuff. I played with angularjs before 2 years ago but I work primarily in java for my job.
-Update changed approach and used
npm install --save js-gantt
My angular-cli-json file
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "my-app"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [
"../node_modules/js-gantt/dist/js-gantt.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
In my app.component.ts file the following:
import { Component } from '@angular/core';
import * as _ from 'js-gantt';
declare var GanttChart;
export class
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'My First Angular App';
}
How do I use this js-gantt inside the page?