0
當我嘗試實例中角4類我得到這個錯誤:角實例化類錯誤
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
) { }
}
個
繼各種StackOverflow的答案,我嘗試了不同的event.ts
,但它產生了同樣的錯誤:
export class Event {
event: string;
readableDate: string;
constructor(public event: string, public readableDate: string) {
this.event = event;
this.readableDate = readableDate;
}
}