how trigger the 'exit' application event in nativescript with angular 2 in onclick of logout button view?

Viewed 6098
2 Answers
  • Install "nativescript-exit" npm i nativescript-exit
  • Import exit function import { exit } from "nativescript-exit";
  • call exit function exit();

import { exit } from "nativescript-exit"; 
// to instal 'nativescript-exit' run in root folder(where node_modules are): 
// npm i nativescript-exit

public logOut(): void {
  exit(); // will close application
}
    <Button text="Log out" (tap)="logOut()"></Button>

Related