Problem with routing in a nativescript project with a sidedrawer


#1

Hi, hope to get some help here. Nativescript is driving me really bad.

I am using the latest NativeScript together with Angular 2 and SideDrawer extension and have a problem with the routing:

Everything except for the home screen is with a separate menu, but as soon as the page loads the redirect to /menu/home does not work. If I enter the component there directly it works but the layout is wrong.

This is my app.routing.ts
https://pastebin.com/1QbUsuXP

See in line 2 the redirect to the component on line 7 but it doesn’t work on Android and shows an empty page instead. On iOS it works. Users have to open the side drawer select one page and click the “back to home screen” button.

Hopefully for every kind of help!

Thanks!


#2

I just want to point you to a working example of NativeScript + Angular + side drawer with routing: http://www.github.com/jlooper/quicknoms-app. I just updated it to use the new separated side drawer package. Hope this might guide you a bit.


#3

Thanks for the tip. Downloaded it, tried to install but after tns build android it broke showing this error message.

tns build android

Executing before-prepare hook from C:\Development\quicknoms-app\hooks\before-prepare\nativescript-dev-typescript.js

Found peer TypeScript 2.4.2

app/main.aot.ts(4,36): error TS2307: Cannot find module ‘./app.module.ngfactory’.

------ Originalnachricht ------


#4

hm, sounds like some AOT/webpack issue. I will fix that, and in the meantime can you try tns run android just to try it in emulator?


#5

Same issue!

tns run android

Searching for devices…

Starting Android emulator with image Pixel_2_XL_API_27_2

Waiting for emulator device initialization…

Executing before-liveSync hook from C:\Development\quicknoms-app\hooks\before-liveSync\nativescript-angular-sync.js

Executing before-prepare hook from C:\Development\quicknoms-app\hooks\before-prepare\nativescript-dev-typescript.js

Found peer TypeScript 2.4.2

app/main.aot.ts(4,36): error TS2307: Cannot find module ‘./app.module.ngfactory’.

Unable to apply changes on device: emulator-5554. Error is: TypeScript compiler failed with exit code 1.

------ Originalnachricht ------