xerotolerant
xerotolerant

Reputation: 2079

Nativescript Typescript error property does not exist

Hello I am trying to get an Image element in a typescript xml page and set it's imageSource property programatically.

In the examples i've found it is done this way:

image = page.getViewById("id");
image.imageSource = newImageSource;

The issue that I am having when using typescript is

error 'imageSource' does not exist on type 'View'

I don't know how to work around that problem. any ideas?

Upvotes: 1

Views: 1084

Answers (1)

Brad Martin
Brad Martin

Reputation: 6167

Do image = <Image> page.getViewById('whatever'); Should resolve the type issue. Make sure to import the image module so you have the correct class.

Upvotes: 5

Related Questions