AppModule.resources is undefined!

nativescriptcore
databinding

#1

Hi!
I’m trying to follow this part of the documentation for {N} Core
https://docs.nativescript.org/core-concepts/data-binding#example-7-adding-converters-in-the-application-module-resources

when I do

app = require("application")
console.log(app.resources);

I am getting undefined

therefore I’m not able to add a convertor to the app module resources.

Is there something that I’m missing?


#2

I created a vanilla app and get the same. If you stringify application you get:

{"launchEvent":"launch","suspendEvent":"suspend","displayedEvent":"displayed","resumeEvent":"resume","exitEvent":"exit","lowMemoryEvent":"lowMemory","uncaughtErrorEvent":"uncaughtError","orientationChangedEvent":"orientationChanged","ios":{"_currentOrientation":0,"_observers":[{},{},{},{},{},{}]}}

Wondering if there’s an issue with the docs.


#3

Yes there could be an issue with the docs here.
should I try to assign an empty object to app.resources
and then use it?

Update: tried it, it didn’t work.
JS: Cannot find function or filter: dateConverter


#4

if you want to post in an edit or question, there’s a link to the docs repo at the bottom


#5

I’ve created an issue on github


#6

Replied to the issue on GutHub. Spoiler: use app.getResources() (docs need an update).


#7

Thanks @Eddy, that works <3
I’ll update the docs and submit PR


#8

Great - now please continue being awesome!