我有以下類:如何創建TypeScript類的實例?
export declare class FlashMessagesService {
show: (text?: string, options?: Object) => void;
grayOut: (value: boolean) => void;
}
我嘗試創建類的實例:
import { FlashMessagesService } from 'angular2-flash-messages';
let _flashMessagesService = new FlashMessagesService();
它調用錯誤:
Cannot read property 'show' of undefined
我用這個library
我認爲我們需要看看'show'方法或它是如何被調用的 –
... btw我不認爲你需要'declare '關鍵字 - 我認爲這通常只適用於環境公司NTEXT。即它不會發出javascript –