Nativescript-angular: [Feature] Provide a way to replace the default 'Page' with a custom instance

Created on 11 Aug 2016  路  3Comments  路  Source: NativeScript/nativescript-angular

Hi,

It would be great if there is a way to change the way nativescript-angular's bootstrap creates the Page instances used though the application life circle. I looked though the code and noticed there is a provider (defaultPageProvider) for the Page elements (not exactly sure how it is utilized as removing it in my fork did not break any navigation) and couple of places where the new Page is being created (for example here and here)

Having the possibility of placing our own class which inherits the Page class in an Angular 2 {N} application will be very useful and as it is already possible in vanilla {N} I think it will make migrating to Angular even easier and better.

Most helpful comment

Hi guys, any progress on this?, has someone found a workaround for android?.

All 3 comments

Some thoughts on that:

The Page provider gives you access to the current page instance that is hosting the component and there is no way to replace it.

Maybe the way to go is to use PageFactoryProvider, that you can replace with custom factory for pages in your app.

Another way of achieving this behavior would be (not sure if possible probably not :)) to use the same approach like the ActionBar in Angular 2, by simply declaring a <Page> in the Component itself. This way we may have different HTML declared Page instances rather than having nativescript-angular create them for us.

Hi guys, any progress on this?, has someone found a workaround for android?.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarvagayatri picture sarvagayatri  路  3Comments

Sulman633 picture Sulman633  路  3Comments

samuelvisscher picture samuelvisscher  路  3Comments

bnussey picture bnussey  路  3Comments

triniwiz picture triniwiz  路  3Comments