I have a problem with my angularjs ionic application. During login we're loading various settings. If I kill the app and re-launch it these settings are not loaded.
I need to know if there's an event that is being invoked when the application launches so that I can reload my app settings.
Thank you
Events is a publish-subscribe style event system for sending and responding to application-level events across your app.
Starting a new Ionic app is incredibly simple. From the command line, run the ionic start command and the CLI will handle the rest. Please enter the full name of your app. You can change this at any time.
Use the --type option to start projects using older versions of Ionic. For example, you can start an Ionic 3 project with --type=ionic-angular . Use --list to see all project types and templates.
Hardware Back Button in Capacitor and CordovaThe @capacitor/app package must be installed in Capacitor apps to use the hardware back button. When running in a Capacitor or Cordova application, Ionic Framework will emit an ionBackButton event when a user presses the hardware back button.
You can add the lines of code to load the settings either in YourIndex.html's Controller or you can put that code under $ionicPlatform.ready
.
Option 1: Run it inside your index.html's controller, because every time you open your app, this controller will be loaded.
var myApp = angular.module('myApp', ['ionic']);
myApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/')
$stateProvider.state('index', {
url: '/',
controller: 'IndexCtrl',
})
});
myApp.controller('IndexCtrl', function($scope) {
//load your settings from localStorage or DB where you saved.
});
Option 2: Call every time Ionic calls deviceReady.
var myApp = angular.module('myApp', ['ionic']);
myApp.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
//load your settings from localStorage or DB where you saved.
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With