Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected 2 arguments, but got 1. #18

Closed
rpvsen opened this issue Feb 12, 2020 · 3 comments
Closed

Expected 2 arguments, but got 1. #18

rpvsen opened this issue Feb 12, 2020 · 3 comments

Comments

@rpvsen
Copy link

rpvsen commented Feb 12, 2020

Hi

I am facing an issue while compiling. can some help me to fix this issue.

Error Message as below

ERROR in src/app/components/gantt.component.ts(19,3): error TS2554: Expected 2 arguments, but got 1.

@ViewChild('gantt_here') ganttContainer: ElementRef;

Code
`import { Component, ElementRef, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { TaskService } from '../services/task.service';
import { LinkService } from '../services/link.service';
import { Task } from '../models/task';
import { Link } from '../models/link';

import 'dhtmlx-gantt';

@component({
encapsulation: ViewEncapsulation.None,
// tslint:disable-next-line:component-selector
selector: 'gantt',
styleUrls: ['./gantt.component.css'],
providers: [TaskService, LinkService],
template: <div #gantt_here class='gantt-chart'></div>,
})

export class GanttComponent implements OnInit {
@ViewChild('gantt_here') ganttContainer: ElementRef;

constructor(private taskService: TaskService, private linkService: LinkService) { }

ngOnInit() {

	gantt.config.xml_date = '%Y-%m-%d %H:%i';

	gantt.init(this.ganttContainer.nativeElement);

	const dp = gantt.createDataProcessor({
		task: {
			update: (data: Task) => this.taskService.update(data),
			create: (data: Task) => this.taskService.insert(data),
			delete: (id) => this.taskService.remove(id)
		},
		link: {
			update: (data: Link) => this.linkService.update(data),
			create: (data: Link) => this.linkService.insert(data),
			delete: (id) => this.linkService.remove(id)
		}
	});

	Promise.all([this.taskService.get(), this.linkService.get()])
		.then(([data, links]) => {
			gantt.parse({ data, links });
		});
}

}`

@gearcoded
Copy link

Hello,
In case if you still need help, you need to replace the following string:

@component({

to this one:

@Component({

And this string:

template: <div #gantt_here class='gantt-chart'></div>,

to this one:

template: `<div #gantt_here class='gantt-chart'></div>`,

@nithin-neewee
Copy link

Hi All,

For the scheduler i am getting this error what need to do please help
image

@gearcoded
Copy link

@nithin-neewee, DHTMLX Scheduler is a different component. I don't think it is a good idea to discuss it here.
Please, create a new topic here:
https://forum.dhtmlx.com/c/scheduler-all

And if you have the license, you can submit the support request according to the instructions in the email with the license.

It will take less time to resolve the issue if you provide the steps to reproduce it or send a ready demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants