ng-ganttv18
v1.0.3
Published
Wrapping jsgantt-improved for Angular 18
Readme
Angular Gantt Editor (for Angular 18)
Angular Gantt Editor (wrapper for jsgantt-improved). View/Edit Gantt file with formatting. Based of https://www.npmjs.com/package/ng-gantt
Installation
To install this library with npm, run below command:
npm install --save jsgantt-improved ng-ganttv18In angular.json add into scripts tag:
"scripts": [
"node_modules/jsgantt-improved/dist/jsgantt.js"
]Usage
Configuration
First, Import Angular GanttEditor module in root
import { NgGanttEditorModule } from 'ng-gantt'
@NgModule({
declarations: [
AppComponent
],
imports: [
....,
NgGanttEditorModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }Then setup your component models as below :
import { Component, ViewChild } from '@angular/core';
import { GanttEditorComponent, GanttEditorOptions } from 'ng-gantt';
@Component({
selector: 'app-root',
template: '<ng-gantt [options]="editorOptions" [data]="data"></ng-gantt>',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public editorOptions: GanttEditorOptions;
public data: any;
@ViewChild(GanttEditorComponent, { static: true }) editor: GanttEditorComponent;
constructor() {
this.editorOptions = new GanttEditorOptions()
this.data = [{
'pID': 1,
'pName': 'Define Chart API',
'pStart': '',
'pEnd': '',
'pClass': 'ggroupblack',
'pLink': '',
'pMile': 0,
'pRes': 'Brian',
'pComp': 0,
'pGroup': 1,
'pParent': 0,
'pOpen': 1,
'pDepend': '',
'pCaption': '',
'pNotes': 'Some Notes text'
}];
}
}Note : For better styling, add below line to your main style.css file
@import "jsgantt-improved/dist/jsgantt.css";License
MIT(./LICENSE)
