0
在我的Angular 4應用程序中,我需要爲使用內部使用角度HttpClient的服務的組件創建一個測試。角度測試和HttpClient:TypeError:無法讀取未定義的屬性'get'
儘管我的我的TestBed
的imports
之間增加HttpClientTestingModule
,我得到:
TypeError: Cannot read property 'get' of undefined
每當組件調用MyService.someMethod()
(內部使用HttpClient.get()
)。
我試着提供服務本身或爲它提供一個模擬,但無論如何我得到的錯誤。