0
我打算在構造函數參數中傳遞一個值,這個接口類型是IDictation。但我得到這個錯誤:Typescript - 在構造函數中傳遞一個接口的數據類型錯誤
Uncaught Error: Can't resolve all parameters for DictationComponent: (?).
我假設打字機編譯器無法識別接口。雖然我輸入了它。
Dictation.Component.ts
import { Component, OnInit } from '@angular/core';
import {IDictation} from './IDictation';
@Component({
selector: 'app-dictation',
templateUrl: './dictation.component.html',
styleUrls: ['./dictation.component.sass'],
})
export class DictationComponent implements OnInit {
private usrLvl : IDictation;
constructor(usrLvl : IDictation)
{}
/**
code
**/
}