Error TS2304: Cannot find name 'page'


#1

Here is my page.ts

page.ts


var viewModel : launchViewModelModule.LaunchViewModel;
viewModel = new launchViewModelModule.LaunchViewModel();

export function navigatingTo(args: observableModule.EventData) {
    var page = <pageModule.Page>args.object;
    page.bindingContext = viewModel;
    }
function showLoginPageForm(slow){
                var initialContainer = page.getViewById("initial-container");
                var mainContainer = page.getViewById("container");
                var containerLogo = page.getViewById("container-logo");
    }

inside the showLoginPageForm another local function to the page.ts file shows the

error TS2304: Cannot find name ‘page’
I don’t know what I am missing


@jen.looper, @tjvantoll, @NathanaelA any help would be gladly appreciated!


#2

page is not defined in the scope of showLoginPageForm so the error is correct. I’m not sure where that function is used, but either pass the page variable to it, or defined it as a property outside the function (perhaps next to viewModel property) and assign it in navigatingTo.


#3

You can easily access Page inside ngOnInit()


#4

He’s not using Angular, and already has a reference in navigatingTo.


#5

Oh my bad then, i read “page.ts” and automatically assumed ts as typescript. My fault


#6

No worries mate. It indeed is TypeScript, but not Angular (you can use plain NativeScript with TypeScript as well).


#7

Thanks guys!
I really appreciate everyone’s contribution on the subject matter,
My plans was to add some animation effect to some element on the page as the getStartedTap() event fires


which will animate some animate some elements here as seen in the picture below