Nativescript-angular: Documentation issue: Application events

Created on 30 Jul 2016  路  3Comments  路  Source: NativeScript/nativescript-angular

I think the current documentation doesn't describe how to use Application Events within nativescript-angular, instead it shows the standard javascript example. Would love to make a correction suggestion, but couldn't figure it out on my own. If anyone has an idea, I would love to hear it!

Link: http://docs.nativescript.org/angular/core-concepts/application-management.html

Most helpful comment

Thank you very much! Please see below the code I used in the end, in case anyone else ever wonders about this issue:

import app = require('application');
import "reflect-metadata";
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {AppComponent} from "./app.component";

app.on(app.launchEvent, function (args: app.ApplicationEventData) {
    // on launch code
});

nativeScriptBootstrap(AppComponent);

All 3 comments

You can still attach to application events in an nativescript-angular app (usually in the main.ts before the bootstrap as any code after it will not be called in ios).

Thank you very much! Please see below the code I used in the end, in case anyone else ever wonders about this issue:

import app = require('application');
import "reflect-metadata";
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {AppComponent} from "./app.component";

app.on(app.launchEvent, function (args: app.ApplicationEventData) {
    // on launch code
});

nativeScriptBootstrap(AppComponent);

How would I make a call to a DI service in this case?

Was this page helpful?
0 / 5 - 0 ratings