RROR TypeError: Cannot read property 'id' of undefined

Can somebody helps me?

I just trying creat a label that change your text when i change my select on ion-select. I used Ionic List template to creat this. The console on Visual Studio Code dont whos any error, but the console on Google Chrome shows this error:

core.js:4197 ERROR TypeError: Cannot read property ‘id’ of undefined
at LibertacaoPage.OnChange (libertacao.page.ts:33)
at LibertacaoPage_Template_ion_select_ionChange_8_listener (template.html:12)
at executeListenerWithErrorHandling (core.js:14316)
at wrapListenerIn_markDirtyAndPreventDefault (core.js:14357)
at HTMLElement. (platform-browser.js:582)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Object.onInvokeTask (core.js:27425)
at ZoneDelegate.invokeTask (zone-evergreen.js:398)
at Zone.runTask (zone-evergreen.js:167)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:480)

How i resolve this? Thx.

Generally, bugs like this get caught if you add "strictPropertyInitialization": true to the compilerOptions of tsconfig.json. If that still doesn’t give you any better information, carefully audit the lifecycle of whatever object you are blindly referencing the id property of in the line mentioned in the error message. It’s not defined at the time you’re trying to access it.

1 Like

Thanks for reply me.