When I try to instantiate a class in Angular 4 I get this error:
Supplied parameters do not match any signature of call target
admin.component.ts:
import { Component } from '@angular/core';
import { Event } from '../event';
@Component({
selector: 'app-admin',
templateUrl: './admin.component.html',
})
export class AdminComponent {
onSubmit() {
const event = new Event('foo', 'bar');
}
}
event.ts:
export class Event {
constructor(
public event: string,
public comments: string
) { }
}
Following various StackOverflow answers I tried a different event.ts but it produced the same error:
export class Event {
event: string;
readableDate: string;
constructor(public event: string, public readableDate: string) {
this.event = event;
this.readableDate = readableDate;
}
}