Reputation: 9
I am a newbie in coding world and learning angular 4. In my application,
I have 3 classes MyGlobalObject.ts
, globalservice.service.ts
and history.ts
.
I am trying to fetch the data from a JSON file (API) having the values in history.ts
, but in globalservice
class, I am getting an error saying property startdateandtime
does not exist on type History[]
.
But the property do exist in the history.ts as shown in the above images having code.
myglobalobject.ts:
History.ts:
globalservice.service.ts:
Upvotes: 0
Views: 1621
Reputation: 4983
The error means the type you have assigned to the variables is different than the data you are trying to put into it.
In your file, either declare type as any. or know the type of data you are going to put into the variable
example:
slno: any;
Upvotes: 1