nativescript-angular icon indicating copy to clipboard operation
nativescript-angular copied to clipboard

Documentation issue: Application events

Open samuelvisscher opened this issue 10 years ago • 3 comments

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

samuelvisscher avatar Jul 30 '16 17:07 samuelvisscher

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).

vakrilov avatar Aug 01 '16 10:08 vakrilov

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);

samuelvisscher avatar Aug 01 '16 21:08 samuelvisscher

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

ullalaaron avatar Apr 09 '18 08:04 ullalaaron