Raas Masood
Raas Masood

Reputation: 1575

error cannot read property count of undeifned

i have an oData controller sending me count of total entities which i am trying to read in javascript i.e. an angular app. The odata.count property is visible with a proper value but i keep on getting error. please refer to the attached image.

snapshot of an error

when i try to read

countResponse.odata.count

i get this error that cannot read property count of undefined.

please guide

Upvotes: 2

Views: 2940

Answers (1)

deadboy
deadboy

Reputation: 859

The reason is that you have a property name with a dot. Your code is trying to access an object on countResponse called odata and then odata's count.

Either change whatever code sets up this property to not use periods or change the syntax to be countResponse["odata.count"].

Upvotes: 4

Related Questions