Closed trunkovich closed 3 years ago
@trunkovich You may be missing the async
option in your boot options. Here's the exact same setup on an example repo I setup showing just the changes you mentioned above but also ensuring the boot async option is there and all works just fine:
https://github.com/NathanWalker/xplatdemo/commit/bd4fe7e1acee6bae9c19fdd81b8cd995fd0a8526
In particular this option in your main.ts:
platformNativeScriptDynamic({
async: true // this must be set
}).bootstrapModule(AppModule);
You can also read about more advanced options here: https://nativescript.org/blog/angular-launch-animations/
@NathanWalker Thank you. It works now. Don't know why it works in plain NS project without this flag...
When you try to use APP_INITIALIZATION factory like it is described here:
https://nativescript.org/blog/angular-10-support/ You get an error:
Steps to reproduce:
app.module
content withimport { AppComponent } from "./app.component";
export function asyncBoot(): Function { return (): Promise => new Promise(resolve => {
setTimeout(() => {
console.log('asyncBoot');
resolve();
}, 30000);
})
}
@NgModule({ bootstrap: [ AppComponent ], imports: [ NativeScriptModule ], declarations: [ AppComponent ], providers: [ { provide: APP_INITIALIZER, useFactory: asyncBoot, multi: true }, ], schemas: [ NO_ERRORS_SCHEMA ] }) export class AppModule { }
import { Component } from '@angular/core';
@Component({ selector: 'test-xplat-unit-tests-root', template: `
` }) export class AppComponent {}